vendredi 5 août 2016

whats wrong with my code? for if else condition

i want to know if whats wrong with my syntax for if else condition.

the gvModal.Rows[y].Cells[10].Text should be For PO because the incoming stock is less than the Requested Quantity.

but in my output, it shows For Delivery

Legend: ams = Ams Balance = 0 //update ItemQuan = Item Quantity = 5000 //update stock = Incoming Stock = 4000 //update

if (ams == 0 && stock == 0 || ((ItemQuan > ams && ams > stock) && ItemQuan > stock))
            {

                gvModal.Rows[y].Cells[10].Text = "For PO";
                gvModal.Rows[y].Cells[10].BackColor = System.Drawing.Color.FromName("#f06868");


            }

            else if (ams == 0 && stock != 0 || ((ams < stock || ItemQuan > ams) && ItemQuan < stock))
            {

                gvModal.Rows[y].Cells[10].Text = "For Delivery";
                gvModal.Rows[y].Cells[10].BackColor = System.Drawing.Color.FromName("#ACD1E9");


            }
            else if (ams != 0 && stock != 0 || ams > ItemQuan)
            {
                gvModal.Rows[y].Cells[10].Text = "For Issuance";
                gvModal.Rows[y].Cells[10].BackColor = System.Drawing.Color.Aqua;

            }
            else if (ams != 0 && stock == 0 || ams > ItemQuan)
            {
                gvModal.Rows[y].Cells[10].Text = "For Issuance";
                gvModal.Rows[y].Cells[10].BackColor = System.Drawing.Color.Aqua;

            }

Aucun commentaire:

Enregistrer un commentaire