Exemplo n.º 1
0
        public void AddPO(PO PO)
        {
            // Initialize SPROC
            SqlConnection conn = new SqlConnection(ConnectionString);
            SqlCommand cmd = new SqlCommand("SPPOInsert", conn);
            cmd.CommandType = CommandType.StoredProcedure;

            // Add Parameters
            cmd.Parameters.AddWithValue("@PoNumber", PO.PoNumber);
            cmd.Parameters.AddWithValue("@CustomerID", PO.CustomerID);
            cmd.Parameters.AddWithValue("@PartNumber", PO.PartNumber);
            cmd.Parameters.AddWithValue("@TrackingNumber", PO.TrackingNumber);
            cmd.Parameters.AddWithValue("@ReceiveDate", PO.ReceiveDate);
            cmd.Parameters.AddWithValue("@HotPart", PO.HotPart);
            cmd.Parameters.AddWithValue("@Color", PO.Color);
            cmd.Parameters.AddWithValue("@Comments", PO.Comments);
            cmd.Parameters.AddWithValue("@InitialQty", PO.InitialQty);
            cmd.Parameters.AddWithValue("@OnHandQty", PO.OnHandQty);
            cmd.Parameters.AddWithValue("@InventoryQty", PO.InventoryQty);
            cmd.Parameters.AddWithValue("@FabRejectQty", PO.FabRejectQty);
            cmd.Parameters.AddWithValue("@PaintRejectQty", PO.PaintRejectQty);
            cmd.Parameters.AddWithValue("@POStatus", PO.POStatus);
            cmd.Parameters.AddWithValue("@RcvComment", PO.RcvComment);
            cmd.Parameters.AddWithValue("@InvComment", PO.InvComment);
            cmd.Parameters.AddWithValue("@ShipComment", PO.ShipComment);
            cmd.Parameters.AddWithValue("@ShipTo", PO.ShipTo);
            cmd.Parameters.AddWithValue("@BillTo", PO.BillTo);
            cmd.Parameters.AddWithValue("@ShippedQty", PO.ShippedQty);

            conn.Open();
            cmd.ExecuteNonQuery();
            conn.Close();
            reload();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Save
            if ((PoNum.Text != "") && (InitQty.Text != ""))
            {
                PO tPO = Form2Object();
                if (cid == 0)
                {
                    POL.AddPO(tPO);
                    PO tPO2 = new PO();
                    tPO2 = POL.FindPO(tPO.CustomerID, tPO.PartNumber, tPO.ReceiveDate, tPO.PoNumber);
                    cid = tPO.Id;
                }
                else
                {

                    tPO.Id = cid;
                    POL.UpdatePO(tPO);
                }
                MessageBox.Show("PO has Been Saved");
                ClearRcv(sender, e);
            }
            else
            {
                MessageBox.Show("Must have PO Number and Inital Quantity");
            }
        }
Exemplo n.º 3
0
        public static PO PopulatePOFromSqlDataReader(SqlDataReader dr)
        {
            PO pO = new PO();

            pO.Id = Convert.ToInt32(dr["Id"]);
            pO.PoNumber = Convert.ToString(dr["PoNumber"]);
            pO.CustomerID = Convert.ToInt32(dr["CustomerID"]);
            pO.PartNumber = Convert.ToString(dr["PartNumber"]);
            pO.TrackingNumber = Convert.ToString(dr["TrackingNumber"]);
            pO.ReceiveDate = Convert.ToDateTime(dr["ReceiveDate"]);
            pO.HotPart = Convert.ToString(dr["HotPart"]);
            pO.Color = Convert.ToString(dr["Color"]);
            pO.Comments = Convert.ToString(dr["Comments"]);
            pO.InitialQty = Convert.ToInt32(dr["InitialQty"]);
            pO.OnHandQty = Convert.ToInt32(dr["OnHandQty"]);
            pO.InventoryQty = Convert.ToInt32(dr["InventoryQty"]);
            pO.FabRejectQty = Convert.ToInt32(dr["FabRejectQty"]);
            pO.PaintRejectQty = Convert.ToInt32(dr["PaintRejectQty"]);
            pO.ShippedQty = Convert.ToInt32(dr["ShippedQty"]);
            pO.POStatus = Convert.ToString(dr["POStatus"]);
            pO.RcvComment = Convert.ToString(dr["RcvComment"]);
            pO.InvComment = Convert.ToString(dr["InvComment"]);
            pO.ShipComment = Convert.ToString(dr["ShipComment"]);
            pO.ShipTo = Convert.ToInt32(dr["ShipTo"]);
            pO.BillTo = Convert.ToInt32(dr["BillTo"]);
            if (dr["CloseDate"] != System.DBNull.Value)
            {
                pO.CloseDate = Convert.ToDateTime(dr["CloseDate"]);
            }
            if (dr["LastShipDate"] != System.DBNull.Value)
            {
                pO.LastShipDate = Convert.ToDateTime(dr["LastShipDate"]);
            }
            return pO;
        }
Exemplo n.º 4
0
 public void AddPO(PO po)
 {
     initRcvQty += po.InitialQty;
     shippedQty += po.ShippedQty;
     onHandQty += po.InventoryQty;
     backOrderQty += po.OnHandQty;
 }
Exemplo n.º 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     DataGridViewRow item = dataGridView1.SelectedRows[0];
     String PONum = item.Cells[0].Value.ToString();
     DateTime rcv = DateTime.Parse(item.Cells[2].Value.ToString());
     rcvPO = pList.FindPO(CustID, PartNum, rcv, PONum);
     this.Hide();
 }
Exemplo n.º 6
0
        public void UpdatePO(PO PO)
        {
            // Initialize SPROC
            SqlConnection conn = new SqlConnection(ConnectionString);
            SqlCommand cmd = new SqlCommand("SPPOUpdate", conn);
            cmd.CommandType = CommandType.StoredProcedure;

            // Update Parameters
            cmd.Parameters.AddWithValue("@Id", PO.Id);
            cmd.Parameters.AddWithValue("@PoNumber", PO.PoNumber);
            cmd.Parameters.AddWithValue("@CustomerID", PO.CustomerID);
            cmd.Parameters.AddWithValue("@PartNumber", PO.PartNumber);
            cmd.Parameters.AddWithValue("@TrackingNumber", PO.TrackingNumber);
            cmd.Parameters.AddWithValue("@ReceiveDate", PO.ReceiveDate);
            cmd.Parameters.AddWithValue("@HotPart", PO.HotPart);
            cmd.Parameters.AddWithValue("@Color", PO.Color);
            cmd.Parameters.AddWithValue("@Comments", PO.Comments);
            cmd.Parameters.AddWithValue("@InitialQty", PO.InitialQty);
            cmd.Parameters.AddWithValue("@OnHandQty", PO.OnHandQty);
            cmd.Parameters.AddWithValue("@InventoryQty", PO.InventoryQty);
            cmd.Parameters.AddWithValue("@FabRejectQty", PO.FabRejectQty);
            cmd.Parameters.AddWithValue("@PaintRejectQty", PO.PaintRejectQty);
            cmd.Parameters.AddWithValue("@ShippedQty", PO.ShippedQty);
            cmd.Parameters.AddWithValue("@POStatus", PO.POStatus);
            cmd.Parameters.AddWithValue("@RcvComment", PO.RcvComment);
            cmd.Parameters.AddWithValue("@InvComment", PO.InvComment);
            cmd.Parameters.AddWithValue("@ShipComment", PO.ShipComment);
            cmd.Parameters.AddWithValue("@ShipTo", PO.ShipTo);
            cmd.Parameters.AddWithValue("@BillTo", PO.BillTo);
            if (PO.CloseDate == null)
            {
                cmd.Parameters.AddWithValue("@CloseDate", System.DBNull.Value);

            }
            else
            {
                cmd.Parameters.AddWithValue("@CloseDate", PO.CloseDate);
            }
            if (PO.LastShipDate == null)
            {
                cmd.Parameters.AddWithValue("@LastShipDate", System.DBNull.Value);

            }
            else
            {
                cmd.Parameters.AddWithValue("@LastShipDate", PO.LastShipDate);
            }
            cmd.Parameters.AddWithValue("@DaysAtAFI", PO.GetDaysatAFI());
            conn.Open();
            cmd.ExecuteNonQuery();
            conn.Close();
            reload();
        }
Exemplo n.º 7
0
        public PO GetPOByID(PO POID)
        {
            // Initialize SPROC
            SqlConnection conn = new SqlConnection(ConnectionString);
            SqlCommand cmd = new SqlCommand("SPGETPOID", conn);
            cmd.CommandType = CommandType.StoredProcedure;

            SqlDataReader reader = null;
            PO pO = null;

            // GetByID Parameters
            cmd.Parameters.AddWithValue("@POID", POID);

            // Execute
            conn.Open();
            reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);

            if (reader.Read())
            {
                pO = PopulatePOFromSqlDataReader(reader);
            }

            conn.Close();

            return pO;
        }
Exemplo n.º 8
0
 private PO Form2Object()
 {
     Customer TCust = CustList.SearchCustomer(CustCombo.Text);
     string hotpart ="N";
     if(HotPartCB.Checked)
     {
         hotpart ="Y";
     }
     PO po = new PO(PoNum.Text,TCust.ID,PartCombo.Text,Tracking.Text,RcvDate.Value,hotpart,Colorlbl.Text,int.Parse(InitQty.Text),RcvComments.Text);
     po.OnHandQty = po.InitialQty;
     return po;
 }
Exemplo n.º 9
0
        private void PopGrid(PO po)
        {
            DataGridViewRow item = new DataGridViewRow();

            item.CreateCells(InvPOGrid);
            item.Cells[0].Value = po.PoNumber;
            item.Cells[1].Value = po.ReceiveDate;
            item.Cells[2].Value = po.InitialQty;
            item.Cells[3].Value = po.FabRejectQty;
            item.Cells[4].Value = po.PaintRejectQty;
            item.Cells[5].Value = po.InventoryQty;
            item.Cells[6].Value = po.ShippedQty;
            item.Cells[7].Value = po.POStatus;
            item.Cells[8].Value = po.Id;
            item.Cells[9].Value = po.OnHandQty;
            if (item.Cells[2].Value.ToString() == "")
            {
                item.Cells[2].Value = "0";
            }
            if (item.Cells[3].Value.ToString() == "")
            {
                item.Cells[3].Value = "0";
            }
            if (item.Cells[4].Value.ToString() == "")
            {
                item.Cells[4].Value = "0";
            }
            if (item.Cells[5].Value.ToString() == "")
            {
                item.Cells[5].Value = "0";
            }
            if (item.Cells[6].Value.ToString() == "")
            {
                item.Cells[6].Value = "0";
            }

            InvPOGrid.Rows.Add(item);
        }
Exemplo n.º 10
0
        private int PopGrid(PO po)
        {
            int totalavqty = 0;

            DataGridViewRow item = new DataGridViewRow();

            item.CreateCells(OpenPOGrid);

            item.Cells[0].Value = po.PoNumber;
            item.Cells[1].Value = po.ReceiveDate;
            item.Cells[2].Value = po.InventoryQty;
            item.Cells[3].Value = po.PaintRejectQty;
            item.Cells[4].Value = po.FabRejectQty;
            item.Cells[5].Value = po.OnHandQty;
            item.Cells[6].Value = po.InvComment;
            if (item.Cells[2].Value.ToString() == "")
            {
                item.Cells[2].Value = "0";
            }
            if (item.Cells[3].Value.ToString() == "")
            {
                item.Cells[3].Value = "0";
            }
            if (item.Cells[4].Value.ToString() == "")
            {
                item.Cells[4].Value = "0";
            }
            if (item.Cells[5].Value.ToString() == "")
            {
                item.Cells[5].Value = "0";
            }
            if (item.Cells[6].Value.ToString() != "")
            {
                item.Cells[7].Value = "*";
            }
            else
            {
                item.Cells[7].Value = "";
            }
            totalavqty = totalavqty + int.Parse(item.Cells[5].Value.ToString());
            OpenPOGrid.Rows.Add(item);

            return totalavqty;
        }