Ejemplo n.º 1
0
        public FrmDiscount(FrmCreateNewInvoice count)
        {
            InitializeComponent();
            cn  = new SqlConnection(dbcon.MyConnection());
            dis = count;

            this.KeyPreview = true;
        }
Ejemplo n.º 2
0
        public FrmQuantity(FrmCreateNewInvoice frm)
        {
            InitializeComponent();
            cn = new SqlConnection(dbcon.MyConnection());
            F2 = frm;

            this.KeyPreview = true;
        }
Ejemplo n.º 3
0
        public FrmLookUp(FrmCreateNewInvoice Fr2)
        {
            InitializeComponent();
            cn = new SqlConnection(dbcon.MyConnection());
            F2 = Fr2;

            this.KeyPreview = true;
        }
Ejemplo n.º 4
0
        public void ShowInvoiceInFront()
        {
            //Off the visibility of the Button of see products
            BtnSeeProducts.Visible = false;
            BtnInvoices.Visible    = false;
            BtnCustomers.Visible   = false;

            //Pass the label name of the user logged in


            //Off the visibility of the Button of User Account
            BtnUserAccount.Visible = false;
            Indicator8.Visible     = false;

            //This line of code here is the process of passing the Full name of account logged in to the system,
            //so, we can record the name of the invoicer who process the order.
            PasslblName = lblUsername.Text;


            //Container 1
            FrmCreateNewInvoice XXL = new FrmCreateNewInvoice();  //Set a variable to call the form

            XXL.Size     = Container1.Size;
            XXL.TopLevel = false;                                //Make the toplevel = 0
            Container1.Controls.Clear();                         //Clear the Container first (Para kung may laman matatanggal muna bago mo ilagay kung anung form man ilalagay mo)
            Container1.Controls.Add(XXL);
            XXL.BringToFront();                                  //Bring the form in front of the other peripherals
            XXL.LoadCustomersFromDatabaseToCustomerCombobox();   // Populate the Customer Combobox with Customer name in the database
            XXL.Show();                                          //Show the form

            //Indicators
            Indicator1.Visible = true;  //1
            Indicator2.Visible = false; //0
            Indicator3.Visible = false; //0
            Indicator4.Visible = false; //0
            Indicator5.Visible = false; //0
            Indicator6.Visible = false; //0
            Indicator7.Visible = false; //0
        }
Ejemplo n.º 5
0
        private void TxtQty_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                if (e.KeyChar == 46)
                {
                    //accept .(for cents or decimal places)
                }
                else if (e.KeyChar == 8)
                {
                    //accept backspace
                }
                else if ((e.KeyChar < 48) || (e.KeyChar > 57)) //ascii code 48 - 57 between 0-9
                {
                    e.Handled = true;
                }

                if ((e.KeyChar == 13) && (txtQty.Text != String.Empty))
                {
                    bool   found       = false;
                    String id          = "";
                    int    invoice_qty = 0;
                    cn.Open();
                    cm = new SqlCommand("SELECT * FROM tblInvoiceOrder WHERE invoiceno = @invoiceno and prodcode = @prodcode", cn);
                    cm.Parameters.AddWithValue("@invoiceno", F2.lblInvoiceNo.Text);
                    cm.Parameters.AddWithValue("@prodcode", prodcode);
                    dr = cm.ExecuteReader();
                    dr.Read();
                    if (dr.HasRows)
                    {
                        found       = true;
                        id          = dr["id"].ToString();
                        invoice_qty = int.Parse(dr["qty"].ToString());
                    }
                    else
                    {
                        found = false;
                    }
                    dr.Close();
                    cn.Close();

                    if (found == true)
                    {
                        //For Stock Validation Condition
                        if (qty < int.Parse(txtQty.Text) + invoice_qty)
                        {
                            MessageBox.Show("Unable to Proceed, Remaining Quantity of product on hand is " + qty, "Stock Validation", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }

                        cn.Open();
                        cm = new SqlCommand("UPDATE tblInvoiceOrder SET qty = (qty + " + int.Parse(txtQty.Text) + ") WHERE id = '" + id + "'", cn);
                        cm.ExecuteNonQuery();
                        cn.Close();

                        F2.LoadInvoiceOrder();
                        this.Dispose();
                    }
                    else
                    {
                        //For Stock Validation Condition
                        if (qty < int.Parse(txtQty.Text) + invoice_qty)
                        {
                            MessageBox.Show("Unable to Proceed. The Remaining Quantity of the product on hand is " + qty, "Stock Validation", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                        FrmCreateNewInvoice inv = new FrmCreateNewInvoice();

                        cn.Open();
                        cm = new SqlCommand("INSERT INTO tblInvoiceOrder (invoiceno, customer, address, prodcode, proddescrip, prodprice, qty, stockdate, name, payment, days, billaddress, duedate) VALUES (@invoiceno, @customer, @address, @code, @desc, @price, @qty, @date, @name, @payment, @days, @bill, @duedate)", cn);
                        cm.Parameters.AddWithValue("@invoiceno", transno);
                        cm.Parameters.AddWithValue("@customer", F2.txtCustomer.Text);
                        cm.Parameters.AddWithValue("@address", F2.txtAddress.Text);
                        cm.Parameters.AddWithValue("@code", prodcode);
                        cm.Parameters.AddWithValue("@desc", proddescrip);
                        cm.Parameters.AddWithValue("@price", prodprice);
                        cm.Parameters.AddWithValue("@qty", int.Parse(txtQty.Text));
                        cm.Parameters.AddWithValue("@name", F2.lblUsername.Text);
                        cm.Parameters.AddWithValue("@date", F2.bunifuDatepicker1.Value);
                        cm.Parameters.AddWithValue("@payment", F2.cbxPayment.Text);;
                        cm.Parameters.AddWithValue("@days", F2.Dmdays.Text);
                        cm.Parameters.AddWithValue("@bill", F2.txtBilling.Text);
                        cm.Parameters.AddWithValue("@duedate", F2.DueDateCalendar.Value.ToString("yyyyMMdd"));
                        cm.ExecuteNonQuery();
                        cn.Close();

                        F2.LoadInvoiceOrder();
                        this.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                cn.Close();
                MessageBox.Show(ex.Message);
                //    MessageBox.Show("Product Quantity is now insufficient.", "Stock Validation", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 6
0
 public FrmInvoicePreview(FrmCreateNewInvoice cre)
 {
     InitializeComponent();
     cn  = new SqlConnection(dbcon.MyConnection());
     inv = cre;
 }