Beispiel #1
0
        private void Generate_GRN_Load(object sender, EventArgs e)
        {
            txtdate.Text = System.DateTime.Now.ToString("MM / dd / yyyy");
            DBPurchases p = new DBPurchases();

            DR = p.getPurchases();
            while (DR.Read())
            {
                cmbPorderNo.Items.Add(DR[0]);
            }
        }
Beispiel #2
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 metroButton2_Click(object sender, EventArgs e)
 {
     if (cmbsupname.SelectedIndex != 0)
     {
         String      name   = cmbsupname.SelectedItem.ToString();
         DBSupplier  sup    = new DBSupplier();
         int         sup_id = sup.getSupNo(name);
         DBPurchases p      = new DBPurchases();
         DR = p.selectOrder(sup_id);
         while (DR.Read())
         {
             cmbporder.Items.Add(DR[0].ToString());
         }
     }
     else
     {
         MessageBox.Show("Please select a supplier name ", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }