示例#1
0
        public InvoiceCompleted(int invoiceID)
        {
            InitializeComponent();
            invoice             = new Invoice(invoiceID);
            invoiceContentsList = InvoiceContentsDatabase.GetInvoiceContents(invoiceID);
            this.customerID     = invoice.customer.StoreID;
            Customer    c           = CustomerDatabase.SearchCustomersByID(customerID);
            ProvinceTax provinceTax = ProvinceTaxDatabase.GetProvinceByName(c.Province);

            if (provinceTax.pst == 0)
            {
                PST = false;
            }
            else
            {
                PST = true;
            }

            panel1.Location    = new Point(30, 135);
            panel1.Size        = new Size(900, 360);
            panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            panel1.AutoScroll  = true;
            panel1.BackColor   = Color.DarkGray;

            this.Controls.Add(panel1);
            AddLabels(customerID);
            AddTotalBoxes(customerID);
            AddItemBoxes();
        }
示例#2
0
文件: InvoiceForm.cs 项目: shewmj/gww
        public InvoiceForm(int customerID)
        {
            InitializeComponent();
            finished        = false;
            this.customerID = customerID;
            customer        = CustomerDatabase.SearchCustomersByID(customerID);
            ProvinceTax provinceTax = ProvinceTaxDatabase.GetProvinceByName(customer.Province);

            if (provinceTax.pst == 0)
            {
                PST = false;
            }
            else
            {
                PST = true;
            }

            panel1.Location    = new Point(30, 145);
            panel1.Size        = new Size(800, 330);
            panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            panel1.AutoScroll  = true;
            panel1.BackColor   = Color.DarkGray;

            this.Controls.Add(panel1);
            AddLabels(customerID);
            AddTotalBoxes(customerID);
            AddFirstRow();
        }
示例#3
0
        public CustomerForm(String storeName, String storeDetails, String officeAddress, String shippingAddress, String storeContact, String emailAddress, String phoneNumber
                            , String province, String paymentTerms, String shippingInstructions, string rep)
        {
            InitializeComponent();
            List <ProvinceTax> provinceTaxList = ProvinceTaxDatabase.GetAllProvinces();

            Object[] arr = new Object[provinceTaxList.Count];
            for (int i = 0; i < provinceTaxList.Count; i++)
            {
                arr[i] = provinceTaxList[i].provinceTax + " - GST: " + provinceTaxList[i].gst + "%/PST: " + provinceTaxList[i].pst + "%";
            }
            provinceTax_comboBox.Items.AddRange(arr);

            setTextBoxLimits();
            storeName_textBox.Text    = storeName;
            storeDetails_textBox.Text = storeDetails;
            parseStringToGroup(officeAddress, groupBox1);
            parseStringToGroup(shippingAddress, groupBox2);
            storeContact_textBox.Text         = storeContact;
            email_textBox.Text                = emailAddress;
            phoneNumber_textBox.Text          = phoneNumber;
            paymentTerms_textBox.Text         = paymentTerms;
            shippingInstructions_textBox.Text = shippingInstructions;
            provinceTax_comboBox.Text         = provinceTax_comboBox.Items[provinceTax_comboBox.FindString(province)].ToString();
            rep_textBox.Text = rep;
            editMode         = true;
            storeNumber      = CustomerDatabase.GetStoreID(storeName, shippingAddress);
        }
示例#4
0
 private static void SeedCustomers(int num)
 {
     for (int i = 1; i < num; i++)
     {
         CustomerDatabase.AddCustomer("ExBusiness" + i, "Details" + i, "SpecialNotes" + i, "email" + i + "@gmail.com", "address" + i, "city" + i, "PR", "PostCo",
                                      "contact" + i, "6041111111", "terms" + i, "shipping" + i, "TA" + i, "rep" + i);
     }
 }
示例#5
0
        public Invoice(int invoiceID)
        {
            // WholeSale Company Information
            CompanyName        = "Great West Wholesale LTD";
            CompanyAddress     = "1670 PANDORA ST. VANCOUVER, BC V5L 1L6";
            CompanyPhoneNumber = "604-255-9588";
            CompanyFax         = "604-255-9589";
            CompanyTollFree    = "1-800-901-9588";
            GSTNo = "R102186178";

            Items = new List <Product>();


            MySqlConnection conn = new MySqlConnection(LoginInfo.LoginCreds);

            try
            {
                conn.Open();
                MySqlCommand    cmd;
                MySqlDataReader rdr;
                String          sql;

                sql = "SELECT * FROM Invoices WHERE InvoiceID = " + invoiceID + ";";
                cmd = new MySqlCommand(sql, conn);
                rdr = cmd.ExecuteReader();

                if (rdr.HasRows)
                {
                    rdr.Read();

                    InvoiceID = Int32.Parse(rdr[0].ToString());

                    customer = CustomerDatabase.SearchCustomersByID(Int32.Parse(rdr[1].ToString()));

                    PurchaseOrder = rdr[2].ToString();



                    List <InvoiceContentInfo> items = InvoiceContentsDatabase.GetInvoiceContents(InvoiceID);
                    Product temp;
                    for (int i = 0; i < items.Count; i++)
                    {
                        temp = ProductDatabase.SearchProductByItemNo(items[i].ItemNo);
                        temp.SpecialNotes          = items[i].SpecialNotes;
                        temp.Quantity              = items[i].Quantity;
                        temp.BackOrder             = items[i].Backorder;
                        temp.BackOrderSpecialNotes = items[i].BackOrderSpecialNotes;
                        Items.Add(temp);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            conn.Close();
        }
示例#6
0
        private void okButton_Click(object sender, EventArgs e)
        {
            Boolean err           = false;
            String  officeAddress = (officeUnit_textBox.Text != String.Empty ? officeUnit_textBox.Text + " - " : "") + officeStreet_textBox.Text + ", " +
                                    officeCity_textBox.Text + ", " + provinceConverter(officeProvince_comboBox.Text) + "  " + officePostal_textBox.Text;


            String shippingAddress = (shippingUnit_textBox.Text != String.Empty ? shippingUnit_textBox.Text + " - " : "") + shippingStreet_textBox.Text + ", " +
                                     shippingCity_textBox.Text + ", " + provinceConverter(shippingProvince_comboBox.Text) + "  " + shippingPostal_textBox.Text;

            if (storeName_textBox.Text == String.Empty)
            {
                label1.ForeColor = Color.Red;
                err = true;
            }
            else
            {
                label1.ForeColor = Color.Black;
            }

            if (shippingAddress.Length < 10)
            {
                groupBox2.ForeColor = Color.Red;
                err = true;
            }
            else
            {
                groupBox2.ForeColor = Color.Black;
            }

            if (provinceTax_comboBox.Text == String.Empty)
            {
                label18.ForeColor = Color.Red;
                err = true;
            }
            else
            {
                label18.ForeColor = Color.Black;
            }
            if (err)
            {
                return;
            }
            if (editMode)
            {
                CustomerDatabase.EditCustomer(storeNumber, storeName_textBox.Text, storeDetails_textBox.Text, email_textBox.Text, officeAddress,
                                              shippingAddress, storeContact_textBox.Text, phoneNumber_textBox.Text, paymentTerms_textBox.Text,
                                              shippingInstructions_textBox.Text, provinceTax_comboBox.Text.Split(' ')[0], rep_textBox.Text);
            }
            else
            {
                CustomerDatabase.AddCustomer(storeName_textBox.Text, storeDetails_textBox.Text, email_textBox.Text, officeAddress,
                                             shippingAddress, storeContact_textBox.Text, phoneNumber_textBox.Text, paymentTerms_textBox.Text,
                                             shippingInstructions_textBox.Text, provinceTax_comboBox.Text.Split(' ')[0], rep_textBox.Text);
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
示例#7
0
        private void CustomerList_DoubleClick(object sender, EventArgs e)
        {
            int         customerID  = CustomerDatabase.GetStoreID(custList.SelectedItems[0].Text, custList.SelectedItems[0].SubItems[3].Text);
            InvoiceForm invoiceForm = new InvoiceForm(customerID);

            invoiceForm.Size = new System.Drawing.Size(900, 700);
            invoiceForm.Show();
            this.Close();
        }
示例#8
0
        private void okButton_Click(object sender, EventArgs e)
        {
            Boolean err = false;


            if (storeName_textBox.Text == String.Empty)
            {
                label1.ForeColor = Color.Red;
                err = true;
            }
            else
            {
                label1.ForeColor = Color.Black;
            }

            if (shippingStreet_textBox.Text.Length == 0 || shippingCity_textBox.Text.Length == 0 || shippingPostal_textBox.Text.Length == 0 || shippingProvince_comboBox.Text.Length == 0)
            {
                groupBox2.ForeColor = Color.Red;
                err = true;
            }
            else
            {
                groupBox2.ForeColor = Color.Black;
            }

            if (provinceTax_comboBox.Text == String.Empty)
            {
                label18.ForeColor = Color.Red;
                err = true;
            }
            else
            {
                label18.ForeColor = Color.Black;
            }
            if (err)
            {
                return;
            }

            if (editMode)
            {
                CustomerDatabase.EditCustomer(storeNumber, storeName_textBox.Text, storeDetails_textBox.Text, storeSpecialNotes_textBox.Text, email_textBox.Text, shippingStreet_textBox.Text,
                                              shippingCity_textBox.Text, provinceConverter(shippingProvince_comboBox.Text), shippingPostal_textBox.Text, storeContact_textBox.Text, phoneNumber_textBox.Text, paymentTerms_textBox.Text,
                                              shippingInstructions_textBox.Text, provinceTax_comboBox.Text.Split(' ')[0], rep_textBox.Text);
            }
            else
            {
                CustomerDatabase.AddCustomer(storeName_textBox.Text, storeDetails_textBox.Text, storeSpecialNotes_textBox.Text, email_textBox.Text, shippingStreet_textBox.Text,
                                             shippingCity_textBox.Text, provinceConverter(shippingProvince_comboBox.Text), shippingPostal_textBox.Text, storeContact_textBox.Text, phoneNumber_textBox.Text, paymentTerms_textBox.Text,
                                             shippingInstructions_textBox.Text, provinceTax_comboBox.Text.Split(' ')[0], rep_textBox.Text);
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
示例#9
0
 private void SelectCustomerButton_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem l in custList.SelectedItems)
     {
         int         customerID  = CustomerDatabase.GetStoreID(l.SubItems[0].Text, l.SubItems[3].Text);
         InvoiceForm invoiceForm = new InvoiceForm(customerID);
         invoiceForm.Size = new System.Drawing.Size(900, 700);
         invoiceForm.Show();
         this.Close();
     }
 }
示例#10
0
        static void SeedData()
        {
            ProvinceTaxDatabase.AddProvinceTax("ON1", 7, 5);
            ProvinceTaxDatabase.AddProvinceTax("ON2", 0, 5);
            ProvinceTaxDatabase.AddProvinceTax("BC1", 7, 12);
            ProvinceTaxDatabase.AddProvinceTax("BC2", 0, 5);
            ProvinceTaxDatabase.AddProvinceTax("BC3", 7, 5);
            ProvinceTaxDatabase.AddProvinceTax("AB1", 7, 5);


            ProductDatabase.AddProduct("12121", "Bouncy Ball", 1, "TSBK", 1.70, 2.50, 3242343, "may7");
            ProductDatabase.AddProduct("34523", "PlayDough", 6, "TS", 3.90, 4.99, 3453453, "discontinued");
            ProductDatabase.AddProduct("78666", "U-Fidget", 15, "TS", 1.25, 2.00, 5645334, "discontinued");
            ProductDatabase.AddProduct("34513", "Kaleidoscope", 20, "TS", 5.50, 6.50, 6433423, "jn9");
            ProductDatabase.AddProduct("89798", "PlayDough", 8, "TS", 1.20, 2.50, 2565443, "discontinued");
            ProductDatabase.AddProduct("45323", "Sidewalk Chalk", 12, "TS00", 5.50, 7.00, 4534634);
            ProductDatabase.AddProduct("89675", "Rubber Duck", 5, "TSD", 1.90, 2.20, 9678565);
            ProductDatabase.AddProduct("34921", "Baseball", 20, "TS2", 3.00, 3.50, 3527657);
            ProductDatabase.AddProduct("90243", "SuperSoaker", 1, "TS3", 10.50, 12.50, 7687432);
            ProductDatabase.AddProduct("43424", "Diving Sub", 10, "TS1", 3.50, 4.00, 1787424);
            ProductDatabase.AddProduct("42131", "Geo Twister", 4, "TS1", 1.50, 2.00, 2437583);
            ProductDatabase.AddProduct("14513", "Chicken Flingers", 16, "TS1", 8.50, 10.00, 5898275);
            ProductDatabase.AddProduct("24235", "Stunt Flyer", 18, "TS1", 4.00, 4.50, 4980240);



            CustomerDatabase.AddCustomer("Splash Toys", "", "*****@*****.**", "1201 Main st, Vancouver, BC  V6G9K7", "1201 Main st, Vancouver, BC  V6G9K7", "Nicole", "6047990643", "net30", "fedex", "BC2", "Kyle");
            CustomerDatabase.AddCustomer("Kaboodles", "", "*****@*****.**", "5601 Broadway st, Vancouver, BC  L6G9K7", "5601 Broadway st, Vancouver, BC  L6G9K7", "Ben", "6047342643", "credit", "canpar", "BC3", "Jake");
            CustomerDatabase.AddCustomer("Childrens Hospital", "Gift Shop", "*****@*****.**", "8901 Cambie st, Vancouver, BC  H7J9K0", "8901 Cambie st, Vancouver, BC  H7J9K0", "Sammy", "6045690643", "net30", "canpar", "BC1", "Kyle");
            CustomerDatabase.AddCustomer("Science World Edmonton", "Gift Shop", "*****@*****.**", "4745 Main st, Edmonton, AB  K7G5F4", "4745 Main st, Edmonton, AB  K7G5F4", "Julie", "6047670643", "net30", "canpar", "AB1", "Mike");

            int custID;

            custID = CustomerDatabase.GetStoreID("Splash Toys", "1201 Main st, Vancouver, BC  V6G9K7");
            InvoiceDatabase.AddInvoice(custID, "2312343", "", "", 0, 0, 0, 0, 1);
            InvoiceDatabase.UpdateBackorderSpecialNotes(custID, "monday only not friday");
            InvoiceContentsDatabase.AddInvoiceContent(1, "12121", 10, "2 Red");
            InvoiceContentsDatabase.AddInvoiceContent(1, "24235", 8, "");
            InvoiceContentsDatabase.AddInvoiceContent(1, "89675", 12, "1 Pink");
            InvoiceContentsDatabase.AddInvoiceContent(1, "90243", 2, "");
            InvoiceContentsDatabase.AddInvoiceContent(1, "43424", 5, "");

            custID = CustomerDatabase.GetStoreID("Kaboodles", "5601 Broadway st, Vancouver, BC  L6G9K7");
            InvoiceDatabase.AddInvoice(custID, "2312343", "", "", 0, 0, 0, 0, 2);
            InvoiceContentsDatabase.AddInvoiceContent(2, "45323", 10, "3 blue");
            InvoiceContentsDatabase.AddInvoiceContent(2, "34523", 8, "");
            InvoiceContentsDatabase.AddInvoiceContent(2, "34513", 12, "1 Pink");
            InvoiceContentsDatabase.AddInvoiceContent(2, "89798", 2, "");
            InvoiceContentsDatabase.AddInvoiceContent(2, "42131", 5, "");
        }
示例#11
0
        public ViewCustomer()
        {
            InitializeComponent();
            AddButtons();
            custList.MultiSelect   = false;
            custList.FullRowSelect = true;
            custList.Size          = new Size(1250, 500);
            custList.Location      = new Point(25, 100);

            custList.Columns.Add("Store Name", 150, HorizontalAlignment.Left);
            custList.Columns.Add("Store Details", -2, HorizontalAlignment.Left);
            custList.Columns.Add("Billing Address", 190, HorizontalAlignment.Left);
            custList.Columns.Add("Shipping Address", 190, HorizontalAlignment.Left);
            custList.Columns.Add("Store Contact", -2, HorizontalAlignment.Left);
            custList.Columns.Add("Email", 100, HorizontalAlignment.Left);
            custList.Columns.Add("Phone Number", 90, HorizontalAlignment.Left);
            custList.Columns.Add("Province Tax", -2, HorizontalAlignment.Left);
            custList.Columns.Add("Payment Terms", -2, HorizontalAlignment.Left);
            custList.Columns.Add("Shipping Instr", -2, HorizontalAlignment.Left);
            custList.Columns.Add("Sales Rep", -2, HorizontalAlignment.Left);

            //custList.Columns.Add("Special Notes ", -2, HorizontalAlignment.Left);



            custList.GridLines     = true;
            custList.Scrollable    = true;
            custList.View          = System.Windows.Forms.View.Details;
            custList.DoubleClick  += CustomerList_DoubleClick;
            custList.FullRowSelect = true;

            this.Controls.Add(custList);

            List <Customer> list = CustomerDatabase.SearchCustomersByStoreName("");

            foreach (Customer c in list)
            {
                /*
                 * ListViewItem l = new ListViewItem(new String[] { c.StoreName, c.StoreDetails, c.OfficeAddress,c.ShippingAddress,c.StoreContact,
                 * c.Email, c.PhoneNumber,c.Province, c.PaymentTerms,c.ShippingInstructions,c.SpecialNotes});
                 * custList.Items.Add(l);
                 * l.Selected = true;
                 * custList.HideSelection = false;
                 */

                custList.Items.Add(new ListViewItem(new String[] { c.StoreName, c.StoreDetails, c.BillingAddress, c.ShippingAddress, c.StoreContact,
                                                                   c.Email, c.PhoneNumber, c.Province, c.PaymentTerms, c.ShippingInstructions, c.Rep }));
            }
        }
示例#12
0
文件: InvoiceForm.cs 项目: shewmj/gww
        private void SubtotalAmount_TextChanged(object sender, EventArgs e)
        {
            Customer    c           = CustomerDatabase.SearchCustomersByID(customerID);
            ProvinceTax provinceTax = ProvinceTaxDatabase.GetProvinceByName(c.Province);
            float       gstRate     = (float)provinceTax.gst / 100;

            this.Controls["gst"].Text          = (Single.Parse(this.Controls["subTotalAmount"].Text) * gstRate).ToString("0.00");
            this.Controls["invoiceTotal"].Text = (Single.Parse(this.Controls["subTotalAmount"].Text) * (1 + gstRate)).ToString("0.00");
            if (PST)
            {
                float pstRate = (float)provinceTax.pst / 100;
                this.Controls["pst"].Text          = (Single.Parse(this.Controls["subTotalAmount"].Text) * pstRate).ToString("0.00");
                this.Controls["invoiceTotal"].Text = (Single.Parse(this.Controls["subTotalAmount"].Text) * (1 + gstRate + pstRate)).ToString("0.00");
            }
        }
示例#13
0
        public SelectCustomer()
        {
            InitializeComponent();
            AddButtons();
            custList.Size     = new Size(1250, 500);
            custList.Location = new Point(25, 100);

            custList.Columns.Add("Store Name", 150, HorizontalAlignment.Left);
            custList.Columns.Add("Store Details", -2, HorizontalAlignment.Left);
            custList.Columns.Add("Store Notes", 120, HorizontalAlignment.Left);
            custList.Columns.Add("Address", 90, HorizontalAlignment.Left);
            custList.Columns.Add("City", 90, HorizontalAlignment.Left);
            custList.Columns.Add("Prov", 40, HorizontalAlignment.Left);
            custList.Columns.Add("Postal Code", 90, HorizontalAlignment.Left);
            custList.Columns.Add("Store Contact", -2, HorizontalAlignment.Left);
            custList.Columns.Add("Email", 100, HorizontalAlignment.Left);
            custList.Columns.Add("Phone Number", 90, HorizontalAlignment.Left);
            custList.Columns.Add("Province Tax", -2, HorizontalAlignment.Left);
            custList.Columns.Add("Payment Terms", -2, HorizontalAlignment.Left);
            custList.Columns.Add("Shipping Instr", -2, HorizontalAlignment.Left);
            custList.Columns.Add("Sales Rep", -2, HorizontalAlignment.Left);



            custList.GridLines     = true;
            custList.Scrollable    = true;
            custList.View          = System.Windows.Forms.View.Details;
            custList.DoubleClick  += CustomerList_DoubleClick;
            custList.FullRowSelect = true;

            this.Controls.Add(custList);

            List <Customer> list = CustomerDatabase.SearchCustomersByStoreName("");

            foreach (Customer c in list)
            {
                custList.Items.Add(new ListViewItem(new String[] { c.StoreName, c.StoreDetails, c.StoreSpecialNotes, c.StreetAddress, c.CityAddress, c.ProvinceAddress, c.PostalCodeAddress, c.StoreContact,
                                                                   c.Email, c.PhoneNumber, c.Province, c.PaymentTerms, c.ShippingInstructions, c.Rep }));
            }
        }
示例#14
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            Customer cust = CustomerDatabase.SearchCustomersByID(customerID);

            for (int i = 0; i < invoiceContentsList.Count; i++)
            {
                int    numBO;
                String itemNo  = this.panel1.Controls["itemNumber" + i].Text;
                String notes   = this.panel1.Controls["specialNotes" + i].Text;
                int    qty     = Int32.Parse(this.panel1.Controls["qty" + i].Text);
                int    entryID = InvoiceContentsDatabase.GetEntryID(invoice.InvoiceID, itemNo);

                if (invoiceContentsList[i].Backorder > 0)
                {
                    numBO = Int32.Parse(this.panel1.Controls["backorder" + i].Text);
                    InvoiceContentsDatabase.EditInvoiceContent(entryID, invoice.InvoiceID, itemNo, qty, notes);
                    InvoiceContentsDatabase.UpdateBackorder(entryID, qty - numBO);
                    InvoiceContentsDatabase.UpdateBackorderSpecialNotes(entryID, this.panel1.Controls["backorderNotes" + i].Text);
                }
            }
            InvoiceDatabase.EditInvoice(invoice.InvoiceID, cust.StoreID, invoice.PurchaseOrder, invoice.SpecialNotes, 0, Single.Parse(this.Controls["subTotalAmount"].Text), Single.Parse(this.Controls["gst"].Text), Single.Parse(this.Controls["pst"].Text), Single.Parse(this.Controls["invoiceTotal"].Text), 3);
        }
示例#15
0
        private void RefreshView()
        {
            List <Customer> list;

            foreach (ListViewItem lvItem in custList.Items)
            {
                custList.Items.Remove(lvItem);
            }
            if (customerTextBox.Text.Length == 0)
            {
                list = CustomerDatabase.SearchCustomersByStoreName("");
            }
            else
            {
                list = CustomerDatabase.SearchCustomersByStoreName(customerTextBox.Text);
            }
            foreach (Customer c in list)
            {
                custList.Items.Add(new ListViewItem(new String[] { c.StoreName, c.StoreDetails, c.BillingAddress, c.ShippingAddress, c.StoreContact,
                                                                   c.Email, c.PhoneNumber, c.Province, c.PaymentTerms, c.ShippingInstructions, c.Rep }));
            }
        }
示例#16
0
 private void DeleteCustomer_Click(object sender, EventArgs e)
 {
     if (custList.SelectedItems.Count > 0)
     {
         var confirmResult = MessageBox.Show("Are you sure to delete this item ??",
                                             "Confirm Delete!!",
                                             MessageBoxButtons.YesNo);
         if (confirmResult == DialogResult.Yes)
         {
             foreach (ListViewItem l in custList.SelectedItems)
             {
                 Debug.Print("storeID" + CustomerDatabase.GetStoreID(l.SubItems[0].Text, l.SubItems[3].Text));
                 CustomerDatabase.DeleteCustomer(CustomerDatabase.GetStoreID(l.SubItems[0].Text, l.SubItems[3].Text));
             }
             RefreshView();
         }
         else
         {
             // If 'No', do something here.
         }
     }
 }
示例#17
0
文件: InvoiceForm.cs 项目: shewmj/gww
        private void AddLabels(int customerID)
        {
            int x = 30;
            int y = 130;

            Customer cust = CustomerDatabase.SearchCustomersByID(customerID);

            //customer labels
            Label storeNameLabel = new Label();

            if (cust.StoreDetails.Length != 0)
            {
                storeNameLabel.Text = "Store:       " + cust.StoreName + " - " + cust.StoreDetails;
            }
            else
            {
                storeNameLabel.Text = "Store:   " + cust.StoreName;
            }
            storeNameLabel.Location = new Point(30, 10);
            storeNameLabel.AutoSize = true;
            this.Controls.Add(storeNameLabel);

            Label officeLabel = new Label();

            officeLabel.Text     = "Address:  " + cust.StreetAddress + " " + cust.CityAddress + ", " + cust.Province + " " + cust.PostalCodeAddress;
            officeLabel.Location = new Point(30, 25);
            officeLabel.AutoSize = true;
            this.Controls.Add(officeLabel);

            Label shippingLabel = new Label();

            shippingLabel.Text     = "Notes:      " + cust.StoreSpecialNotes;
            shippingLabel.Location = new Point(30, 40);
            shippingLabel.AutoSize = true;
            this.Controls.Add(shippingLabel);

            Label contactLabel = new Label();

            contactLabel.Text     = "Contact:   " + cust.StoreContact;
            contactLabel.Location = new Point(30, 55);
            contactLabel.AutoSize = true;
            this.Controls.Add(contactLabel);

            Label emailLabel = new Label();

            emailLabel.Text     = "Email:       " + cust.Email;
            emailLabel.Location = new Point(30, 70);
            emailLabel.AutoSize = true;
            this.Controls.Add(emailLabel);

            Label phoneLabel = new Label();

            phoneLabel.Text     = "Phone:     " + cust.PhoneNumber;
            phoneLabel.Location = new Point(30, 85);
            phoneLabel.AutoSize = true;
            this.Controls.Add(phoneLabel);


            Label paymentLabel = new Label();

            paymentLabel.Text     = "Payment Terms: " + cust.PaymentTerms;
            paymentLabel.Location = new Point(500, 10);
            paymentLabel.AutoSize = true;
            this.Controls.Add(paymentLabel);

            Label shippingInstructionsLabel = new Label();

            shippingInstructionsLabel.Text     = "Shipping Instr.:   " + cust.ShippingInstructions;
            shippingInstructionsLabel.Location = new Point(500, 25);
            shippingInstructionsLabel.AutoSize = true;
            this.Controls.Add(shippingInstructionsLabel);


            Label purchaseOrderLabel = new Label();

            purchaseOrderLabel.Text     = "PO #:";
            purchaseOrderLabel.Location = new Point(500, 40);
            purchaseOrderLabel.AutoSize = true;
            this.Controls.Add(purchaseOrderLabel);

            TextBox purchaseOrder = new TextBox();

            purchaseOrder.Location       = new Point(580, 38);
            purchaseOrder.Size           = new Size(100, 25);
            purchaseOrder.Name           = "purchaseOrder";
            purchaseOrder.AccessibleName = "purchaseOrder";
            purchaseOrder.KeyPress      += Qty_KeyPress;
            this.Controls.Add(purchaseOrder);

            //Invoice column headers
            Label qtyLabel = new Label();

            qtyLabel.Text      = "Qty";
            qtyLabel.Location  = new Point(x, y);
            qtyLabel.AutoSize  = true;
            qtyLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(qtyLabel);

            Label itemNoLabel = new Label();

            itemNoLabel.Text      = "Item Number";
            itemNoLabel.Location  = new Point(x + 50, y);
            itemNoLabel.AutoSize  = true;
            itemNoLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(itemNoLabel);

            Label locLabel = new Label();

            locLabel.Text      = "Location";
            locLabel.Location  = new Point(x + 170, y);
            locLabel.AutoSize  = true;
            locLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(locLabel);

            Label descLabel = new Label();

            descLabel.Text      = "Description";
            descLabel.Location  = new Point(x + 240, y);
            descLabel.AutoSize  = true;
            descLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(descLabel);

            Label cartonLabel = new Label();

            cartonLabel.Text      = "Pack";
            cartonLabel.Location  = new Point(x + 460, y);
            cartonLabel.AutoSize  = true;
            cartonLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(cartonLabel);

            Label costLabel = new Label();

            costLabel.Text      = "Cost";
            costLabel.Location  = new Point(x + 510, y);
            costLabel.AutoSize  = true;
            costLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(costLabel);

            Label amountLabel = new Label();

            amountLabel.Text      = "Amount";
            amountLabel.Location  = new Point(x + 580, y);
            amountLabel.AutoSize  = true;
            amountLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(amountLabel);

            Label specialNotesLabel = new Label();

            specialNotesLabel.Text      = "Special Notes";
            specialNotesLabel.Location  = new Point(x + 640, y);
            specialNotesLabel.AutoSize  = true;
            specialNotesLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(specialNotesLabel);

            Button cancelButton = new Button();

            cancelButton.Location = new Point(720, 620);
            cancelButton.Size     = new Size(50, 25);
            cancelButton.Text     = "Cancel";
            cancelButton.Click   += CancelButton_Click;
            this.Controls.Add(cancelButton);

            Button okButton = new Button();

            okButton.Location = new Point(780, 620);
            okButton.Size     = new Size(50, 25);
            okButton.Text     = "OK";
            okButton.Click   += OkButton_Click;
            this.Controls.Add(okButton);
        }
示例#18
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("Are you sure this invoice is complete?",
                                                "Confirm Completion!!",
                                                MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                Customer cust = CustomerDatabase.SearchCustomersByID(customerID);

                for (int i = 0; i < invoiceContentsList.Count; i++)
                {
                    int    numBO;
                    String itemNo  = this.panel1.Controls["itemNumber" + i].Text;
                    String notes   = this.panel1.Controls["specialNotes" + i].Text;
                    int    qty     = Int32.Parse(this.panel1.Controls["qty" + i].Text);
                    int    entryID = InvoiceContentsDatabase.GetEntryID(invoice.InvoiceID, itemNo);

                    if (this.panel1.Controls["backorder" + i].Text.Length == 0)
                    {
                        InvoiceContentsDatabase.EditInvoiceContent(entryID, invoice.InvoiceID, itemNo, qty, notes);
                        continue;
                    }
                    else
                    {
                        numBO = Int32.Parse(this.panel1.Controls["backorder" + i].Text);
                        InvoiceContentsDatabase.EditInvoiceContent(entryID, invoice.InvoiceID, itemNo, qty, notes);
                        InvoiceContentsDatabase.UpdateBackorder(entryID, qty - numBO);
                        InvoiceContentsDatabase.UpdateBackorderSpecialNotes(entryID, this.panel1.Controls["backorderNotes" + i].Text);
                    }
                }
                InvoiceDatabase.EditInvoice(invoice.InvoiceID, cust.StoreID, invoice.PurchaseOrder, invoice.SpecialNotes, 0, Single.Parse(this.Controls["subTotalAmount"].Text), Single.Parse(this.Controls["gst"].Text), Single.Parse(this.Controls["pst"].Text), Single.Parse(this.Controls["invoiceTotal"].Text), 2);

                // Query DB for Invoice
                Invoice printInvoice = new Invoice(invoice.InvoiceID);

                // Define & populate Object to define Table columns for datasource in .rdlc Report
                List <InvoiceItemDetail> invoiceItemDetails;
                invoiceItemDetails = new List <InvoiceItemDetail>();

                for (int i = 0; i < printInvoice.Items.Count; i++)
                {
                    invoiceItemDetails.Add(new InvoiceItemDetail());
                    invoiceItemDetails[i].InvoiceID = invoice.InvoiceID;

                    // Quantity not updated in DB; Subtraction required
                    int SubQuantity = printInvoice.Items[i].Quantity - printInvoice.Items[i].BackOrder;

                    // Invoice Data
                    invoiceItemDetails[i].QTY                  = SubQuantity;
                    invoiceItemDetails[i].GrabCarton           = printInvoice.Items[i].Quantity / printInvoice.Items[i].PerCarton;
                    invoiceItemDetails[i].ItemNo               = printInvoice.Items[i].ItemNo;
                    invoiceItemDetails[i].Location             = printInvoice.Items[i].Location;
                    invoiceItemDetails[i].Description          = printInvoice.Items[i].ItemDesc;
                    invoiceItemDetails[i].CartonTotal          = printInvoice.Items[i].PerCarton;
                    invoiceItemDetails[i].InvoiceItemSellPrice = printInvoice.Items[i].SellPrice;
                    invoiceItemDetails[i].InvoiceItemAmount    = SubQuantity * printInvoice.Items[i].SellPrice;
                    invoiceItemDetails[i].InvoiceItemNote      = printInvoice.Items[i].SpecialNotes;

                    // Backorder Data
                    invoiceItemDetails[i].Backorder           = printInvoice.Items[i].BackOrder;
                    invoiceItemDetails[i].BackorderGrabCarton = printInvoice.Items[i].BackOrder / printInvoice.Items[i].PerCarton;
                    invoiceItemDetails[i].BackorderNote       = printInvoice.Items[i].BackOrderSpecialNotes;
                }

                Form PrintForm = new PrintInvoiceProgress(printInvoice, invoiceItemDetails);
                PrintForm.ShowDialog();

                this.Close();
            }
            else
            {
                // If 'No', do something here.
            }
        }
示例#19
0
        private void AddLabels(int customerID)
        {
            int x = 30;
            int y = 120;

            Customer    cust        = CustomerDatabase.SearchCustomersByID(customerID);
            ProvinceTax provinceTax = ProvinceTaxDatabase.GetProvinceByName(cust.Province);

            //customer labels
            Label storeNameLabel = new Label();

            if (cust.StoreDetails.Length != 0)
            {
                storeNameLabel.Text = "Store name: " + cust.StoreName + " - " + cust.StoreDetails;
            }
            else
            {
                storeNameLabel.Text = "Store name: " + cust.StoreName;
            }
            storeNameLabel.Location = new Point(30, 10);
            storeNameLabel.AutoSize = true;
            this.Controls.Add(storeNameLabel);

            Label officeLabel = new Label();

            officeLabel.Text     = "Billing Address: " + cust.BillingAddress;
            officeLabel.Location = new Point(30, 25);
            officeLabel.AutoSize = true;
            this.Controls.Add(officeLabel);

            Label shippingLabel = new Label();

            shippingLabel.Text     = "Shipping Address: " + cust.ShippingAddress;
            shippingLabel.Location = new Point(30, 40);
            shippingLabel.AutoSize = true;
            this.Controls.Add(shippingLabel);

            Label contactLabel = new Label();

            contactLabel.Text     = "Store Contact: " + cust.StoreContact;
            contactLabel.Location = new Point(30, 55);
            contactLabel.AutoSize = true;
            this.Controls.Add(contactLabel);

            Label emailLabel = new Label();

            emailLabel.Text     = "Email: " + cust.Email;
            emailLabel.Location = new Point(30, 70);
            emailLabel.AutoSize = true;
            this.Controls.Add(emailLabel);

            Label phoneLabel = new Label();

            phoneLabel.Text     = "Phone: " + cust.PhoneNumber;
            phoneLabel.Location = new Point(500, 10);
            phoneLabel.AutoSize = true;
            this.Controls.Add(phoneLabel);

            Label provinceLabel = new Label();

            provinceLabel.Text     = "Province Tax: " + cust.Province + " - GST/PST(" + provinceTax.gst + "%/" + provinceTax.pst + "%)";
            provinceLabel.Location = new Point(500, 25);
            provinceLabel.AutoSize = true;
            this.Controls.Add(provinceLabel);

            Label paymentLabel = new Label();

            paymentLabel.Text     = "Payment Terms: " + cust.PaymentTerms;
            paymentLabel.Location = new Point(500, 40);
            paymentLabel.AutoSize = true;
            this.Controls.Add(paymentLabel);

            Label shippingInstructionsLabel = new Label();

            shippingInstructionsLabel.Text     = "Shipping Instructions: " + cust.ShippingInstructions;
            shippingInstructionsLabel.Location = new Point(500, 55);
            shippingInstructionsLabel.AutoSize = true;
            this.Controls.Add(shippingInstructionsLabel);

            Label invoiceIDLabel = new Label();

            invoiceIDLabel.Text     = "Local Invoice ID: " + invoice.InvoiceID;
            invoiceIDLabel.Location = new Point(500, 70);
            invoiceIDLabel.AutoSize = true;
            this.Controls.Add(invoiceIDLabel);

            Label purchaseOrderLabel = new Label();

            purchaseOrderLabel.Text     = "PO#:" + invoice.PurchaseOrder;
            purchaseOrderLabel.Location = new Point(30, 85);
            purchaseOrderLabel.AutoSize = true;
            this.Controls.Add(purchaseOrderLabel);

            Label invoiceSpecialNotesLabel = new Label();

            invoiceSpecialNotesLabel.Text     = "Special Notes: " + invoice.SpecialNotes;
            invoiceSpecialNotesLabel.Location = new Point(180, 85);
            invoiceSpecialNotesLabel.AutoSize = true;
            this.Controls.Add(invoiceSpecialNotesLabel);

            Label invoiceNumberLabel = new Label();

            invoiceNumberLabel.Text     = "Invoice #: " + invoice.InvoiceNo;
            invoiceNumberLabel.Location = new Point(700, 10);
            invoiceNumberLabel.AutoSize = true;
            this.Controls.Add(invoiceNumberLabel);

            Label backorderInvoiceNotesLabel = new Label();

            backorderInvoiceNotesLabel.Text     = "Backorder Invoice Notes: " + invoice.BackorderNotes;
            backorderInvoiceNotesLabel.Location = new Point(30, 100);
            backorderInvoiceNotesLabel.AutoSize = true;
            this.Controls.Add(backorderInvoiceNotesLabel);

            //Invoice column headers
            Label qtyLabel = new Label();

            qtyLabel.Text      = "Qty";
            qtyLabel.Location  = new Point(x, y);
            qtyLabel.AutoSize  = true;
            qtyLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(qtyLabel);

            Label itemNoLabel = new Label();

            itemNoLabel.Text      = "Item Number";
            itemNoLabel.Location  = new Point(x + 50, y);
            itemNoLabel.AutoSize  = true;
            itemNoLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(itemNoLabel);

            Label locLabel = new Label();

            locLabel.Text      = "Location";
            locLabel.Location  = new Point(x + 170, y);
            locLabel.AutoSize  = true;
            locLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(locLabel);

            Label descLabel = new Label();

            descLabel.Text      = "Description";
            descLabel.Location  = new Point(x + 240, y);
            descLabel.AutoSize  = true;
            descLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(descLabel);

            Label cartonLabel = new Label();

            cartonLabel.Text      = "Pack";
            cartonLabel.Location  = new Point(x + 460, y);
            cartonLabel.AutoSize  = true;
            cartonLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(cartonLabel);

            Label costLabel = new Label();

            costLabel.Text      = "Cost";
            costLabel.Location  = new Point(x + 510, y);
            costLabel.AutoSize  = true;
            costLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(costLabel);

            Label amountLabel = new Label();

            amountLabel.Text      = "Amount";
            amountLabel.Location  = new Point(x + 580, y);
            amountLabel.AutoSize  = true;
            amountLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(amountLabel);

            Label specialNotesLabel = new Label();

            specialNotesLabel.Text      = "Special Notes";
            specialNotesLabel.Location  = new Point(x + 640, y);
            specialNotesLabel.AutoSize  = true;
            specialNotesLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(specialNotesLabel);

            Label backorderLabel = new Label();

            backorderLabel.Text      = "B.O.";
            backorderLabel.Location  = new Point(x + 790, y);
            backorderLabel.AutoSize  = true;
            backorderLabel.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(backorderLabel);

            Button cancelButton = new Button();

            cancelButton.Location = new Point(720, 620);
            cancelButton.Size     = new Size(50, 25);
            cancelButton.Text     = "Cancel";
            cancelButton.Click   += CancelButton_Click;
            this.Controls.Add(cancelButton);

            Button okButton = new Button();

            okButton.Location = new Point(780, 620);
            okButton.Size     = new Size(50, 25);
            okButton.Text     = "OK";
            okButton.Click   += OkButton_Click;
            this.Controls.Add(okButton);

            Button printButton = new Button();

            printButton.Location = new Point(665, 620);
            printButton.Size     = new Size(50, 25);
            printButton.Text     = "Print";
            printButton.Click   += PrintButton_Click;
            this.Controls.Add(printButton);
        }
示例#20
0
        private void AddTotalBoxes(int customerID)
        {
            Customer cust = CustomerDatabase.SearchCustomersByID(customerID);

            Label subtotalLabel = new Label();

            subtotalLabel.Text     = "Subtotal";
            subtotalLabel.Location = new Point(562, 500);
            subtotalLabel.AutoSize = true;
            this.Controls.Add(subtotalLabel);

            TextBox subtotalAmount = new TextBox();

            subtotalAmount.Location       = new Point(610, 500);
            subtotalAmount.Size           = new Size(50, 25);
            subtotalAmount.Text           = invoice.SubTotal.ToString("0.00");
            subtotalAmount.ReadOnly       = true;
            subtotalAmount.Name           = "subtotalAmount";
            subtotalAmount.AccessibleName = "subtotalAmount";
            subtotalAmount.TextChanged   += SubtotalAmount_TextChanged;
            this.Controls.Add(subtotalAmount);

            Label gstLabel = new Label();

            gstLabel.Text      = "GST";
            gstLabel.Location  = new Point(560, 530);
            gstLabel.Size      = new Size(50, 25);
            gstLabel.TextAlign = ContentAlignment.TopRight;
            this.Controls.Add(gstLabel);

            TextBox gst = new TextBox();

            gst.Location       = new Point(610, 530);
            gst.Size           = new Size(50, 25);
            gst.Text           = invoice.Gst.ToString("0.00");
            gst.ReadOnly       = true;
            gst.Name           = "gst";
            gst.AccessibleName = "gst";
            this.Controls.Add(gst);

            if (PST)
            {
                Label pstLabel = new Label();
                pstLabel.Text      = "PST";
                pstLabel.Location  = new Point(560, 560);
                pstLabel.Size      = new Size(50, 25);
                pstLabel.TextAlign = ContentAlignment.TopRight;
                this.Controls.Add(pstLabel);

                TextBox pst = new TextBox();
                pst.Location       = new Point(610, 560);
                pst.Size           = new Size(50, 25);
                pst.Text           = invoice.Pst.ToString("0.00");
                pst.ReadOnly       = true;
                pst.Name           = "pst";
                pst.AccessibleName = "pst";
                this.Controls.Add(pst);

                Label feightLabel = new Label();
                feightLabel.Text      = "Freight";
                feightLabel.Location  = new Point(570, 590);
                feightLabel.AutoSize  = true;
                feightLabel.TextAlign = ContentAlignment.TopRight;
                this.Controls.Add(feightLabel);

                TextBox freight = new TextBox();
                freight.Location       = new Point(610, 590);
                freight.Size           = new Size(50, 25);
                freight.Name           = "freight";
                freight.AccessibleName = "freight";
                freight.TextChanged   += Freight_TextChanged1;
                freight.Text           = invoice.freight.ToString("0.00");
                freight.ReadOnly       = true;
                this.Controls.Add(freight);

                Label invoiceTotalLabel = new Label();
                invoiceTotalLabel.Text     = "Invoice Total";
                invoiceTotalLabel.Location = new Point(540, 620);
                invoiceTotalLabel.AutoSize = true;
                this.Controls.Add(invoiceTotalLabel);

                TextBox invoiceTotal = new TextBox();
                invoiceTotal.Location       = new Point(610, 620);
                invoiceTotal.Size           = new Size(50, 25);
                invoiceTotal.Text           = invoice.NetTotal.ToString("0.00");
                invoiceTotal.ReadOnly       = true;
                invoiceTotal.Name           = "invoiceTotal";
                invoiceTotal.AccessibleName = "invoiceTotal";
                this.Controls.Add(invoiceTotal);
            }
            else //no pst
            {
                Label feightLabel = new Label();
                feightLabel.Text      = "Freight";
                feightLabel.Location  = new Point(570, 560);
                feightLabel.AutoSize  = true;
                feightLabel.TextAlign = ContentAlignment.TopRight;
                this.Controls.Add(feightLabel);

                TextBox freight = new TextBox();
                freight.Location       = new Point(610, 560);
                freight.Size           = new Size(50, 25);
                freight.Name           = "freight";
                freight.AccessibleName = "freight";
                freight.TextChanged   += Freight_TextChanged;
                this.Controls.Add(freight);

                Label invoiceTotalLabel = new Label();
                invoiceTotalLabel.Text     = "Invoice Total";
                invoiceTotalLabel.Location = new Point(540, 590);
                invoiceTotalLabel.AutoSize = true;
                this.Controls.Add(invoiceTotalLabel);

                TextBox invoiceTotal = new TextBox();
                invoiceTotal.Location       = new Point(610, 590);
                invoiceTotal.Size           = new Size(50, 25);
                invoiceTotal.Text           = invoice.NetTotal.ToString("0.00");
                invoiceTotal.ReadOnly       = true;
                invoiceTotal.Name           = "invoiceTotal";
                invoiceTotal.AccessibleName = "invoiceTotal";
                this.Controls.Add(invoiceTotal);
            }
        }
示例#21
0
文件: InvoiceForm.cs 项目: shewmj/gww
        private void OkButton_Click(object sender, EventArgs e)
        {
            bool valid = true;

            for (int j = 0; j < i; j++)
            {
                if (this.panel1.Controls["qty" + j].Text.Length == 0 & this.panel1.Controls["itemNumber" + j].Text.Length != 0)
                {
                    valid = false;
                    this.panel1.Controls["qty" + j].BackColor = Color.Red;
                }

                if (this.panel1.Controls["qty" + j].Text.Length != 0 & this.panel1.Controls["itemNumber" + j].Text.Length == 0)
                {
                    valid = false;
                    this.panel1.Controls["itemNumber" + j].BackColor = Color.Red;
                }
                if (this.panel1.Controls["qty" + j].Text.Length == 1 && this.panel1.Controls["qty" + j].Text == "-")
                {
                    valid = false;
                    this.panel1.Controls["qty" + j].BackColor = Color.Red;
                }
            }

            if (valid == true)
            {
                var confirmResult = MessageBox.Show("Are you sure this invoice is complete?",
                                                    "Confirm Completion!!",
                                                    MessageBoxButtons.YesNo);
                if (confirmResult == DialogResult.Yes)
                {
                    Customer cust = CustomerDatabase.SearchCustomersByID(customerID);
                    int      invoiceID;


                    invoiceID = InvoiceDatabase.AddInvoice(customerID, this.Controls["purchaseOrder"].Text, "");


                    for (int j = 0; j < i; j++)
                    {
                        if (this.panel1.Controls["qty" + j].Text.Length != 0)
                        {
                            String itemNo = this.panel1.Controls["itemNumber" + j].Text;
                            int    qty    = Int32.Parse(this.panel1.Controls["qty" + j].Text);
                            String notes  = this.panel1.Controls["specialNotes" + j].Text;
                            InvoiceContentsDatabase.AddInvoiceContent(invoiceID, itemNo, qty, notes);
                        }
                    }

                    Invoice invoice = new Invoice(invoiceID);
                    invoice.SaveToExcel();
                    finished = true;

                    this.Close();
                }
                else
                {
                    // If 'No', do something here.
                }
            }
        }
示例#22
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("Are you sure this invoice is complete?",
                                                "Confirm Completion!!",
                                                MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                if (this.Controls["invoiceNumber"].Text.Length == 0)
                {
                    this.Controls["invoiceNumber"].BackColor = Color.Red;
                    return;
                }
                Customer cust = CustomerDatabase.SearchCustomersByID(customerID);

                for (int i = 0; i < invoiceContentsList.Count; i++)
                {
                    int    numBO;
                    String itemNo  = this.panel1.Controls["itemNumber" + i].Text;
                    String notes   = this.panel1.Controls["specialNotes" + i].Text;
                    int    qty     = Int32.Parse(this.panel1.Controls["qty" + i].Text);
                    int    entryID = InvoiceContentsDatabase.GetEntryID(invoice.InvoiceID, itemNo);

                    if (invoiceContentsList[i].Backorder > 0)
                    {
                        numBO = Int32.Parse(this.panel1.Controls["backorder" + i].Text);
                        InvoiceContentsDatabase.EditInvoiceContent(entryID, invoice.InvoiceID, itemNo, qty, notes);
                        InvoiceContentsDatabase.UpdateBackorderSpecialNotes(entryID, this.panel1.Controls["backorderNotes" + i].Text);
                    }
                }
                int invoiceNumber;

                invoiceNumber = Int32.Parse(this.Controls["invoiceNumber"].Text);

                float freight = 0;
                if (this.Controls["freight"].Text.Length == 0)
                {
                    freight = 0;
                }
                else
                {
                    freight = Single.Parse(this.Controls["freight"].Text);
                }
                InvoiceDatabase.EditInvoice(invoice.InvoiceID, cust.StoreID, invoice.PurchaseOrder, invoice.SpecialNotes, invoiceNumber, Single.Parse(this.Controls["subTotalAmount"].Text), Single.Parse(this.Controls["gst"].Text), Single.Parse(this.Controls["pst"].Text), Single.Parse(this.Controls["invoiceTotal"].Text), 3);
                InvoiceDatabase.UpdateFreight(invoice.InvoiceID, freight);
                InvoiceDatabase.UpdateBackorderSpecialNotes(invoice.InvoiceID, this.Controls["backorderInvoiceNotes"].Text);

                bool hasBackorder = false;

                for (int i = 0; i < invoice.Items.Count; i++)
                {
                    if (invoice.Items[i].BackOrder > 0)
                    {
                        hasBackorder = true;
                        break;
                    }
                }

                if (hasBackorder)
                {
                    InvoiceDatabase.UpdateBackorderSpecialNotes(invoice.InvoiceID, this.Controls["backorderInvoiceNotes"].Text);
                }
                else
                {
                    InvoiceDatabase.UpdateBackorderSpecialNotes(invoice.InvoiceID, "");
                }

                // Query DB for updated results.
                Invoice printInvoice = new Invoice(invoice.InvoiceID);

                // Define & populate Object to define Table columns for datasource in .rdlc Report
                List <InvoiceItemDetail> invoiceItemDetails;
                invoiceItemDetails = new List <InvoiceItemDetail>();

                for (int i = 0; i < invoice.Items.Count; i++)
                {
                    invoiceItemDetails.Add(new InvoiceItemDetail());

                    // Invoice Order Data
                    invoiceItemDetails[i].InvoiceID = invoice.InvoiceID;
                    invoiceItemDetails[i].QTY       = printInvoice.Items[i].Quantity;
                    // Hide GrabCarton in Final Invoice Report
                    invoiceItemDetails[i].GrabCarton  = 0.0f;
                    invoiceItemDetails[i].ItemNo      = printInvoice.Items[i].ItemNo;
                    invoiceItemDetails[i].Description = printInvoice.Items[i].ItemDesc;
                    // Hide CartonTotal in Final Invoice Report
                    invoiceItemDetails[i].CartonTotal          = 0;
                    invoiceItemDetails[i].InvoiceItemSellPrice = printInvoice.Items[i].SellPrice;
                    invoiceItemDetails[i].InvoiceItemAmount    = printInvoice.Items[i].Quantity * printInvoice.Items[i].SellPrice;
                    invoiceItemDetails[i].InvoiceItemNote      = printInvoice.Items[i].SpecialNotes;

                    // Backorder Data
                    invoiceItemDetails[i].Backorder           = printInvoice.Items[i].BackOrder;
                    invoiceItemDetails[i].BackorderGrabCarton = 0.0f;
                    invoiceItemDetails[i].BackorderNote       = printInvoice.Items[i].BackOrderSpecialNotes;
                }

                Form PrintForm = new PrintInvoiceProgress(printInvoice, invoiceItemDetails);
                PrintForm.ShowDialog();

                this.Close();
            }
            else
            {
                // If 'No', do something here.
            }
        }
示例#23
0
文件: Invoice.cs 项目: StoutSheep/GWW
        public Invoice(int invoiceID)
        {
            // WholeSale Company Information
            CompanyName        = "Great West Wholesale LTD";
            CompanyAddress     = "1670 PANDORA ST. VANCOUVER, BC V5L 1L6";
            CompanyPhoneNumber = "604-255-9588";
            CompanyFax         = "604-255-9589";
            CompanyTollFree    = "1-800-901-9588";
            GSTNo = "R102186178";

            Items = new List <Product>();
            String pswd    = "password";
            String user    = "******";
            String connStr = "server=localhost;user="******";database=GWW;port=3306;password="******"SELECT * FROM Invoices WHERE InvoiceID = " + invoiceID + ";";
                cmd = new MySqlCommand(sql, conn);
                rdr = cmd.ExecuteReader();

                //InvoiceID | StoreID | PurchaseOrder | SpecialNotes | InvoiceNo | SubTotal | Gst | Pst | NetTotal | Stage |

                if (rdr.HasRows)
                {
                    rdr.Read();

                    InvoiceID = Int32.Parse(rdr[0].ToString());

                    customer = CustomerDatabase.SearchCustomersByID(Int32.Parse(rdr[1].ToString()));

                    CustomerName          = customer.StoreName;
                    CustomerContact       = customer.StoreContact;
                    CustomerAddress       = customer.ShippingAddress;
                    CustomerPhone         = customer.PhoneNumber;
                    CustomerTerms         = customer.PaymentTerms;
                    CustomerShippingTerms = customer.ShippingInstructions;

                    PurchaseOrder = rdr[2].ToString();

                    SpecialNotes = rdr[3].ToString();

                    BackorderNotes = rdr[4].ToString();
                    InvoiceNo      = rdr[5].ToString();
                    SubTotal       = Single.Parse(rdr[6].ToString());

                    Gst      = Single.Parse(rdr[7].ToString());
                    Pst      = Single.Parse(rdr[8].ToString());
                    NetTotal = Single.Parse(rdr[9].ToString());
                    freight  = Single.Parse(rdr[10].ToString());
                    Stage    = Int32.Parse(rdr[11].ToString());

                    List <InvoiceContentInfo> items = InvoiceContentsDatabase.GetInvoiceContents(InvoiceID);
                    Product temp;
                    for (int i = 0; i < items.Count; i++)
                    {
                        temp = ProductDatabase.SearchProductByItemNo(items[i].ItemNo);
                        temp.SpecialNotes          = items[i].SpecialNotes;
                        temp.Quantity              = items[i].Quantity;
                        temp.BackOrder             = items[i].Backorder;
                        temp.BackOrderSpecialNotes = items[i].BackOrderSpecialNotes;
                        Items.Add(temp);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            conn.Close();
        }
示例#24
0
文件: InvoiceForm.cs 项目: shewmj/gww
        private void AddTotalBoxes(int customerID)
        {
            Customer    cust        = CustomerDatabase.SearchCustomersByID(customerID);
            ProvinceTax provinceTax = ProvinceTaxDatabase.GetProvinceByName(cust.Province);

            Label subtotalLabel = new Label();

            subtotalLabel.Text     = "Subtotal";
            subtotalLabel.Location = new Point(562, 500);
            subtotalLabel.AutoSize = true;
            this.Controls.Add(subtotalLabel);

            TextBox subtotalAmount = new TextBox();

            subtotalAmount.Location       = new Point(610, 500);
            subtotalAmount.Size           = new Size(50, 25);
            subtotalAmount.ReadOnly       = true;
            subtotalAmount.Name           = "subtotalAmount";
            subtotalAmount.AccessibleName = "subtotalAmount";
            subtotalAmount.TextChanged   += SubtotalAmount_TextChanged;
            this.Controls.Add(subtotalAmount);

            Label gstLabel = new Label();

            gstLabel.Text      = "GST " + provinceTax.gst + "%";
            gstLabel.Location  = new Point(560, 530);
            gstLabel.Size      = new Size(50, 25);
            gstLabel.TextAlign = ContentAlignment.TopRight;
            this.Controls.Add(gstLabel);

            TextBox gst = new TextBox();

            gst.Location       = new Point(610, 530);
            gst.Size           = new Size(50, 25);
            gst.ReadOnly       = true;
            gst.Name           = "gst";
            gst.AccessibleName = "gst";
            this.Controls.Add(gst);

            if (PST)
            {
                Label pstLabel = new Label();
                pstLabel.Text      = "PST " + provinceTax.pst + "%";
                pstLabel.Location  = new Point(560, 560);
                pstLabel.Size      = new Size(50, 25);
                pstLabel.TextAlign = ContentAlignment.TopRight;
                this.Controls.Add(pstLabel);

                TextBox pst = new TextBox();
                pst.Location       = new Point(610, 560);
                pst.Size           = new Size(50, 25);
                pst.ReadOnly       = true;
                pst.Name           = "pst";
                pst.AccessibleName = "pst";
                this.Controls.Add(pst);

                Label invoiceTotalLabel = new Label();
                invoiceTotalLabel.Text     = "Invoice Total";
                invoiceTotalLabel.Location = new Point(540, 590);
                invoiceTotalLabel.AutoSize = true;
                this.Controls.Add(invoiceTotalLabel);

                TextBox invoiceTotal = new TextBox();
                invoiceTotal.Location       = new Point(610, 590);
                invoiceTotal.Size           = new Size(50, 25);
                invoiceTotal.ReadOnly       = true;
                invoiceTotal.Name           = "invoiceTotal";
                invoiceTotal.AccessibleName = "invoiceTotal";
                this.Controls.Add(invoiceTotal);
            }
            else //no pst
            {
                Label invoiceTotalLabel = new Label();
                invoiceTotalLabel.Text     = "Invoice Total";
                invoiceTotalLabel.Location = new Point(540, 560);
                invoiceTotalLabel.AutoSize = true;
                this.Controls.Add(invoiceTotalLabel);

                TextBox invoiceTotal = new TextBox();
                invoiceTotal.Location       = new Point(610, 560);
                invoiceTotal.Size           = new Size(50, 25);
                invoiceTotal.ReadOnly       = true;
                invoiceTotal.Name           = "invoiceTotal";
                invoiceTotal.AccessibleName = "invoiceTotal";
                this.Controls.Add(invoiceTotal);
            }
        }
示例#25
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            bool valid = true;

            for (int j = 0; j < i; j++)
            {
                if (this.panel1.Controls["qty" + j].Text.Length == 0 & this.panel1.Controls["itemNumber" + j].Text.Length != 0)
                {
                    valid = false;
                    this.panel1.Controls["qty" + j].BackColor = Color.Red;
                }

                if (this.panel1.Controls["qty" + j].Text.Length != 0 & this.panel1.Controls["itemNumber" + j].Text.Length == 0)
                {
                    valid = false;
                    this.panel1.Controls["itemNumber" + j].BackColor = Color.Red;
                }
                if (this.panel1.Controls["qty" + j].Text.Length == 1 && this.panel1.Controls["qty" + j].Text == "-")
                {
                    valid = false;
                    this.panel1.Controls["qty" + j].BackColor = Color.Red;
                }
            }

            if (valid == true)
            {
                var confirmResult = MessageBox.Show("Are you sure this invoice is complete?",
                                                    "Confirm Completion!!",
                                                    MessageBoxButtons.YesNo);
                if (confirmResult == DialogResult.Yes)
                {
                    Customer cust = CustomerDatabase.SearchCustomersByID(customerID);
                    int      invoiceID;
                    if (PST)
                    {
                        invoiceID = InvoiceDatabase.AddInvoice(customerID, this.Controls["purchaseOrder"].Text, this.Controls["invoiceSpecialNotes"].Text, "",
                                                               Single.Parse(this.Controls["subtotalAmount"].Text), Single.Parse(this.Controls["gst"].Text),
                                                               Single.Parse(this.Controls["pst"].Text), Single.Parse(this.Controls["invoiceTotal"].Text), 1);
                    }
                    else
                    {
                        invoiceID = InvoiceDatabase.AddInvoice(customerID, this.Controls["purchaseOrder"].Text, this.Controls["invoiceSpecialNotes"].Text, "",
                                                               Single.Parse(this.Controls["subtotalAmount"].Text), Single.Parse(this.Controls["gst"].Text),
                                                               0, Single.Parse(this.Controls["invoiceTotal"].Text), 1);
                    }

                    for (int j = 0; j < i; j++)
                    {
                        if (this.panel1.Controls["qty" + j].Text.Length != 0)
                        {
                            String itemNo = this.panel1.Controls["itemNumber" + j].Text;
                            int    qty    = Int32.Parse(this.panel1.Controls["qty" + j].Text);
                            String notes  = this.panel1.Controls["specialNotes" + j].Text;
                            InvoiceContentsDatabase.AddInvoiceContent(invoiceID, itemNo, qty, notes);
                        }
                    }

                    // Query DB for updated results.
                    Invoice printInvoice = new Invoice(invoiceID);
                    printInvoice.InvoiceNo = "0";

                    // Define & populate Object to define Table columns for datasource in .rdlc Report
                    List <InvoiceItemDetail> invoiceItemDetails;
                    invoiceItemDetails = new List <InvoiceItemDetail>();

                    for (int i = 0; i < printInvoice.Items.Count; i++)
                    {
                        invoiceItemDetails.Add(new InvoiceItemDetail());

                        // Invoice Order Data
                        invoiceItemDetails[i].InvoiceID            = invoiceID;
                        invoiceItemDetails[i].QTY                  = printInvoice.Items[i].Quantity;
                        invoiceItemDetails[i].GrabCarton           = printInvoice.Items[i].Quantity / printInvoice.Items[i].PerCarton;
                        invoiceItemDetails[i].ItemNo               = printInvoice.Items[i].ItemNo;
                        invoiceItemDetails[i].Location             = printInvoice.Items[i].Location;
                        invoiceItemDetails[i].Description          = printInvoice.Items[i].ItemDesc;
                        invoiceItemDetails[i].CartonTotal          = printInvoice.Items[i].PerCarton;
                        invoiceItemDetails[i].InvoiceItemSellPrice = printInvoice.Items[i].SellPrice;
                        invoiceItemDetails[i].InvoiceItemAmount    = printInvoice.Items[i].Quantity * printInvoice.Items[i].SellPrice;
                        invoiceItemDetails[i].InvoiceItemNote      = printInvoice.Items[i].SpecialNotes;

                        // Backorder Data
                        invoiceItemDetails[i].Backorder           = printInvoice.Items[i].BackOrder;
                        invoiceItemDetails[i].BackorderGrabCarton = printInvoice.Items[i].BackOrder / printInvoice.Items[i].PerCarton;
                        invoiceItemDetails[i].BackorderNote       = printInvoice.Items[i].BackOrderSpecialNotes;
                    }

                    Form PrintForm = new PrintInvoiceProgress(printInvoice, invoiceItemDetails);
                    PrintForm.ShowDialog();

                    this.Close();
                }
                else
                {
                    // If 'No', do something here.
                }
            }
        }