Beispiel #1
0
        private void metroTile1_Click(object sender, EventArgs e)
        {
            int error = 0;

            if (metroTextBox4.Text.Length == 0 && metroTextBox3.Text.Length == 0 && metroTextBox5.Text.Length == 0)
            {
                error = 1;
                MessageBox.Show("Check if all the fields are filled", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (cmbPorderNo.SelectedIndex == 0)
            {
                error = 1;
                MessageBox.Show("Please select a Purchase Order Number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (metroComboBox1.SelectedIndex == 0)
            {
                error = 1;
                MessageBox.Show("Please select an Item Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (metroTextBox4.Text.Any(Char.IsLetter))
            {
                error = 1;
                MessageBox.Show("Quantity cannot contain letters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }


            if (error == 0)
            {
                int    flag             = 0;
                String date             = txtdate.Text;
                int    Purchase_OrderNo = Convert.ToInt32(cmbPorderNo.SelectedItem);
                DBGRN  g                = new DBGRN();
                int    GRN_No           = g.setGRN(count_qty, count_tot, date, u_id, Purchase_OrderNo);
                DBGRN_Item_reference gp = new DBGRN_Item_reference();
                foreach (DataGridViewRow Datarow in dataGridView1.Rows)
                {
                    if (Datarow.Cells[0].Value != null && Datarow.Cells[1].Value != null && Datarow.Cells[2].Value != null)
                    {
                        String itemname = dataGridView1.CurrentRow.Cells["Item_Name"].Value.ToString();
                        int    itemqty  = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Item_Qty"].Value);
                        int    itemtot  = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Sub_Total"].Value);
                        DBItem di       = new DBItem();
                        int    itemno   = di.getItemNo(itemname);
                        line = gp.setData(itemno, itemqty, itemtot, GRN_No);
                        di.updateQty(itemno, itemqty, txtdate.Text.ToString(), flag);
                    }
                }
                if (line == 1)
                {
                    MessageBox.Show("Data Entered Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(" Database Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Beispiel #2
0
        private void mtadd_Click_1(object sender, EventArgs e)
        {
            int     flag = 1, error = 0;
            String  date   = txtdate.Text;
            String  status = txtstatus.Text;
            DBSales ds     = new DBSales();

            if (txtqty.Text.Length == 0 && txtprice.Text.Length == 0 && txtstatus.Text.Length == 0)
            {
                MessageBox.Show("Check if all the fields are filled", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                error = 1;
            }
            if (txtprice.Text.Any(Char.IsLetter))
            {
                MessageBox.Show("Price cannot contain letters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                error = 1;
            }
            if (txtqty.Text.Any(Char.IsLetter))
            {
                error = 1;
                MessageBox.Show("Quantity cannot contain letters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (cmbitemname.SelectedIndex == 0)
            {
                error = 1;
                MessageBox.Show("Please select an Item Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (error == 1)
            {
                MessageBox.Show("Check if all the fields are filled correctly", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }


            else
            {
                int so_no = ds.setSalesOrder(date, status, count_tot, count_qty, u_id, no);
                DBSales_Item_reference S_I_ref = new DBSales_Item_reference();
                foreach (DataGridViewRow Datarow in dataGridView1.Rows)
                {
                    if (Datarow.Cells[0].Value != null && Datarow.Cells[1].Value != null && Datarow.Cells[2].Value != null)
                    {
                        String itemName = dataGridView1.CurrentRow.Cells["itemName"].Value.ToString();
                        int    itemqty  = Convert.ToInt32(dataGridView1.CurrentRow.Cells["itemQty"].Value);
                        int    itemtot  = Convert.ToInt32(dataGridView1.CurrentRow.Cells["itemPrice"].Value);

                        DBItem di     = new DBItem();
                        int    itemno = di.getItemNo(itemName);
                        S_I_ref.setReference(so_no, itemno, itemqty, itemtot);
                        di.updateQty(itemno, itemqty, txtdate.Text.ToString(), flag);
                    }
                }
            }
        }
Beispiel #3
0
        private void mtadd_Click(object sender, EventArgs e)
        {
            int error = 0;

            if (txtprice.Text.Length == 0 && txtstatus.Text.Length == 0 && txtqty.Text.Length == 0)
            {
                error = 1;
                MessageBox.Show("Please fill out all the fields", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            if (cmbitemname.SelectedIndex == 0)
            {
                error = 1;
                MessageBox.Show("Please select an Item Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (cmbsupname.SelectedIndex == 0)
            {
                error = 1;
                MessageBox.Show("Please select a Supplier Name", "Ërror", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (txtprice.Text.Any(Char.IsLetter))
            {
                error = 1;
                MessageBox.Show("Price cannot contain letters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (txtqty.Text.Any(Char.IsLetter))
            {
                error = 1;
                MessageBox.Show("Quantity cannot contain letters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (error != 1)
            {
                String      date    = txtdate.Text;
                String      status  = txtstatus.Text;
                String      supname = cmbsupname.SelectedItem.ToString();
                DBSupplier  sup     = new DBSupplier();
                int         sup_no  = sup.getSupNo(supname);
                DBPurchases dp      = new DBPurchases();
                int         po_no   = dp.setPurchaseOrder(date, status, count_tot, count_qty, Users_ID, sup_no);
                DBPurchase_Item_reference P_I_ref = new DBPurchase_Item_reference();
                foreach (DataGridViewRow Datarow in dataGridView1.Rows)
                {
                    if (Datarow.Cells[0].Value != null && Datarow.Cells[1].Value != null && Datarow.Cells[2].Value != null)
                    {
                        String itemName = dataGridView1.CurrentRow.Cells["Item_Name"].Value.ToString();
                        int    itemqty  = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Item_Qty"].Value);
                        int    itemtot  = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Sub_Total"].Value);
                        DBItem di       = new DBItem();
                        int    itemno   = di.getItemNo(itemName);
                        P_I_ref.setReference(po_no, itemno, itemqty, itemtot);
                    }
                }
            }
        }
        private void cmbitemname_SelectedIndexChanged(object sender, EventArgs e)
        {
            int Qty = 0;
            DBSales_Item_reference sal = new DBSales_Item_reference();
            String itemname            = cmbitemname.SelectedItem.ToString();
            DBItem i      = new DBItem();
            int    itemno = i.getItemNo(itemname);

            DR = sal.getQty(itemno);
            while (DR.Read())
            {
                Qty = Convert.ToInt32(DR[0]);
            }

            numQty.Maximum = Qty;
            numQty.Value   = Qty;
        }
Beispiel #5
0
 private void mt_ADD_Click(object sender, EventArgs e)
 {
     if (metroComboBox1.SelectedIndex != 0 && metroTextBox4.Text.Length != 0)
     {
         DBItem   i        = new DBItem();
         String   itemname = metroComboBox1.SelectedItem.ToString();
         int      no       = i.getItemNo(itemname);
         int      qty      = Convert.ToInt32(metroTextBox4.Text);
         int      price    = i.getItemPrice(metroComboBox1.SelectedItem.ToString());
         int      subtot   = price * qty;
         String[] row      = { itemname, qty.ToString(), subtot.ToString() };
         dataGridView1.Rows.Add(row);
         count_qty          = count_qty + qty;
         count_tot          = count_tot + subtot;
         metroTextBox3.Text = count_tot.ToString();
         metroTextBox5.Text = count_qty.ToString();
     }
     else
     {
         MessageBox.Show("Please fill out all the fields", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
        private void metroButton1_Click(object sender, EventArgs e)
        {
            if (numQty.Value != 0)
            {
                DBItem i     = new DBItem();
                int    no    = i.getItemNo(cmbitemname.Text.ToString());
                int    qty   = Convert.ToInt32(numQty.Value);
                int    price = i.getItemPrice(cmbitemname.Text.ToString());

                int      subtot = price * qty;
                String[] row    = { no.ToString(), qty.ToString(), subtot.ToString() };
                dataGridView1.Rows.Add(row);
                count_qty      = count_qty + qty;
                count_tot      = count_tot + subtot;
                txtprice.Text  = count_tot.ToString();
                txttotqty.Text = count_qty.ToString();
            }
            else
            {
                MessageBox.Show("Please select item return quantity", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
 private void btnadd_Click(object sender, EventArgs e)
 {
     if (metroTextBox1.Text.Length != 0)
     {
         DBItem i  = new DBItem();
         int    no = i.getItemNo(metroTextBox1.Text.ToString());
         //dataGridView1.CurrentRow.Cells["Item_No"].Value = no.ToString();
         // dataGridView1.CurrentRow.Cells["Item_Qty"].Value = txtqty.Text;
         int qty   = Convert.ToInt32(numQty.Value);
         int price = i.getItemPrice(metroTextBox1.Text.ToString());
         // dataGridView1.CurrentRow.Cells["Sub_Total"].Value = (price * Convert.ToInt32(txtqty.Text));
         int      subtot = price * qty;
         String[] row    = { no.ToString(), qty.ToString(), subtot.ToString() };
         dataGridView1.Rows.Add(row);
         count_qty      = count_qty + qty;
         count_tot      = count_tot + subtot;
         txtprice.Text  = count_tot.ToString();
         txttotqty.Text = count_qty.ToString();
     }
     else
     {
         MessageBox.Show("Please fill out all the fields", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }