Esempio n. 1
0
        private static void SeedInvoices(int num)
        {
            int invoiceID = 1;

            //make invoices for 5 customers
            for (int i = 1; i < num; i++)
            {
                //make 5 invoice per customer
                for (int j = 1; j < 5; j++)
                {
                    InvoiceDatabase.AddInvoice(invoiceID, i, "order" + j, "invoice" + j);

                    //make num items in each invoice
                    for (int m = 1; m < num; m++)
                    {
                        InvoiceContentsDatabase.AddInvoiceContent(invoiceID, "A" + m, m, "notes");
                    }


                    Invoice inv = new Invoice(invoiceID);
                    inv.SaveToExcel();
                    invoiceID++;
                }
            }
        }
Esempio n. 2
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();
        }
Esempio n. 3
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();
        }
Esempio n. 4
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, "");
        }
Esempio n. 5
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);
        }
Esempio n. 6
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;


                    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.
                }
            }
        }
Esempio n. 7
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.
            }
        }
Esempio n. 8
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.
                }
            }
        }
Esempio n. 9
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.
            }
        }
Esempio n. 10
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>();
            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();
        }