Exemplo n.º 1
0
        private void PrintButton_Click(object sender, EventArgs e)
        {
            // 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());

                // Invoice Data
                invoiceItemDetails[i].InvoiceID            = invoice.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].Description          = printInvoice.Items[i].ItemDesc;
                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(invoice, invoiceItemDetails);

            PrintForm.ShowDialog();

            this.Close();
        }
Exemplo n.º 2
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.
            }
        }
Exemplo n.º 3
0
        private void PrintButton_Click(object sender, EventArgs e)
        {
            String backordernotes;
            bool   hasBackorder = false;

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

            if (hasBackorder)
            {
                backordernotes = this.Controls["backorderInvoiceNotes"].Text;
            }
            else
            {
                backordernotes = "";
            }

            float freight = 0;

            if (this.Controls["freight"].Text.Length == 0)
            {
                freight = 0;
            }
            else
            {
                freight = Single.Parse(this.Controls["freight"].Text);
            }

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

            printInvoice.InvoiceID = 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());

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

                // Invoice Data
                invoiceItemDetails[i].InvoiceID            = invoice.InvoiceID;
                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;
            }
            printInvoice.BackorderNotes = backordernotes;
            printInvoice.freight        = freight;

            Form PrintForm = new PrintInvoiceProgress(printInvoice, invoiceItemDetails);

            PrintForm.ShowDialog();
        }
Exemplo n.º 4
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.
                }
            }
        }
Exemplo n.º 5
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.
            }
        }