示例#1
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();
        }
示例#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();
        }
示例#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();
        }
示例#4
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");
            }
        }
示例#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);
        }
示例#6
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);
        }
示例#7
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);
            }
        }
示例#8
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);
        }
示例#9
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);
            }
        }
示例#10
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.
                }
            }
        }
示例#11
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.
            }
        }
示例#12
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.
                }
            }
        }
示例#13
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.
            }
        }
示例#14
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();
        }