Click here to Skip to main content
15,897,371 members
Articles / Desktop Programming / Windows Forms

Internal Supply Chain Management System, Visibility

Rate me:
Please Sign up or sign in to vote.
4.78/5 (30 votes)
9 Oct 2009CPOL7 min read 106.3K   16.5K   108  
Internal supply chain management system's objective is to visualize organization's activities and events spawn during its work flow and offers panoramic view of upstream and downstream activities
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ISCMS.Control
{
    public class ActivityBalloon : Hasan.CBalloonBase
    {
        private Label Tags;
        private Label lblGoods;
        private Label lblUnit;
        private Label label2;
        private Label lblStatus;
        private Label label4;
        private Label lblDate;
        private Label label6;
        private Label label8;
        private Label lblJob;
        private Label label10;
        private Hasan.TextBox txtComments;
        private System.ComponentModel.IContainer components = null;
        int ID = 0;
        private Label lblUnit_Cost;
        private Label label3;
        private Label lblCost;
        private Label label5;
        private Hasan.CustomLabel Header;
        //Color statusColor;

        public ActivityBalloon()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();
        }

        public ActivityBalloon(int id,Color col)
        {
            ID = id;
            // This call is required by the Windows Form Designer.
            InitializeComponent();
            FrameBottomRight = col;
        }

        public ActivityBalloon(string tag, string name,Color col)
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();
            Tags.Text = tag;
            lblGoods.Text = name;
            FrameBottomRight = col;
        }


        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }

        #region Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.Tags = new System.Windows.Forms.Label();
            this.lblGoods = new System.Windows.Forms.Label();
            this.lblUnit = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.lblStatus = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.lblDate = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.lblJob = new System.Windows.Forms.Label();
            this.label10 = new System.Windows.Forms.Label();
            this.txtComments = new Hasan.TextBox();
            this.Header = new Hasan.CustomLabel();
            this.lblUnit_Cost = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.lblCost = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            // 
            // Tags
            // 
            this.Tags.AutoSize = true;
            this.Tags.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold);
            this.Tags.ForeColor = System.Drawing.Color.SaddleBrown;
            this.Tags.Location = new System.Drawing.Point(34, 80);
            this.Tags.Name = "Tags";
            this.Tags.Size = new System.Drawing.Size(90, 13);
            this.Tags.TabIndex = 0;
            this.Tags.Text = "Raw Material";
            // 
            // lblGoods
            // 
            this.lblGoods.AutoSize = true;
            this.lblGoods.Location = new System.Drawing.Point(127, 80);
            this.lblGoods.Name = "lblGoods";
            this.lblGoods.Size = new System.Drawing.Size(34, 13);
            this.lblGoods.TabIndex = 1;
            this.lblGoods.Text = "---------";
            this.lblGoods.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            // 
            // lblUnit
            // 
            this.lblUnit.AutoSize = true;
            this.lblUnit.Location = new System.Drawing.Point(127, 104);
            this.lblUnit.Name = "lblUnit";
            this.lblUnit.Size = new System.Drawing.Size(34, 13);
            this.lblUnit.TabIndex = 3;
            this.lblUnit.Text = "---------";
            this.lblUnit.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold);
            this.label2.ForeColor = System.Drawing.Color.SaddleBrown;
            this.label2.Location = new System.Drawing.Point(96, 104);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(33, 13);
            this.label2.TabIndex = 2;
            this.label2.Text = "Unit";
            // 
            // lblStatus
            // 
            this.lblStatus.AutoSize = true;
            this.lblStatus.Location = new System.Drawing.Point(127, 152);
            this.lblStatus.Name = "lblStatus";
            this.lblStatus.Size = new System.Drawing.Size(34, 13);
            this.lblStatus.TabIndex = 5;
            this.lblStatus.Text = "---------";
            this.lblStatus.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold);
            this.label4.ForeColor = System.Drawing.Color.SaddleBrown;
            this.label4.Location = new System.Drawing.Point(81, 152);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(48, 13);
            this.label4.TabIndex = 4;
            this.label4.Text = "Status";
            // 
            // lblDate
            // 
            this.lblDate.AutoSize = true;
            this.lblDate.BackColor = System.Drawing.Color.Transparent;
            this.lblDate.Location = new System.Drawing.Point(236, 152);
            this.lblDate.Name = "lblDate";
            this.lblDate.Size = new System.Drawing.Size(34, 13);
            this.lblDate.TabIndex = 7;
            this.lblDate.Text = "---------";
            this.lblDate.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            // 
            // label6
            // 
            this.label6.AutoSize = true;
            this.label6.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold);
            this.label6.ForeColor = System.Drawing.Color.SaddleBrown;
            this.label6.Location = new System.Drawing.Point(204, 152);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(37, 13);
            this.label6.TabIndex = 6;
            this.label6.Text = "Date";
            // 
            // label8
            // 
            this.label8.AutoSize = true;
            this.label8.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold);
            this.label8.ForeColor = System.Drawing.Color.SaddleBrown;
            this.label8.Location = new System.Drawing.Point(82, 199);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(75, 13);
            this.label8.TabIndex = 8;
            this.label8.Text = "Comments";
            // 
            // lblJob
            // 
            this.lblJob.AutoSize = true;
            this.lblJob.Location = new System.Drawing.Point(127, 177);
            this.lblJob.Name = "lblJob";
            this.lblJob.Size = new System.Drawing.Size(34, 13);
            this.lblJob.TabIndex = 11;
            this.lblJob.Text = "---------";
            this.lblJob.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            // 
            // label10
            // 
            this.label10.AutoSize = true;
            this.label10.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold);
            this.label10.ForeColor = System.Drawing.Color.SaddleBrown;
            this.label10.Location = new System.Drawing.Point(100, 177);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(29, 13);
            this.label10.TabIndex = 10;
            this.label10.Text = "Job";
            // 
            // txtComments
            // 
            this.txtComments.BackColor = System.Drawing.Color.Gainsboro;
            this.txtComments.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.txtComments.Currencyed = Hasan.Currency.None;
            this.txtComments.Digits = -1;
            this.txtComments.Location = new System.Drawing.Point(85, 216);
            this.txtComments.Masked = Hasan.Mask.None;
            this.txtComments.Multiline = true;
            this.txtComments.Name = "txtComments";
            this.txtComments.Precision = 2;
            this.txtComments.ReadOnly = true;
            this.txtComments.Size = new System.Drawing.Size(213, 56);
            this.txtComments.TabIndex = 12;
            // 
            // Header
            // 
            this.Header.BackColor = System.Drawing.Color.LightGray;
            this.Header.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.Header.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
            this.Header.Location = new System.Drawing.Point(36, 38);
            this.Header.Name = "Header";
            this.Header.Size = new System.Drawing.Size(301, 26);
            this.Header.TabIndex = 13;
            this.Header.Text = "Status";
            this.Header.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            // 
            // lblUnit_Cost
            // 
            this.lblUnit_Cost.AutoSize = true;
            this.lblUnit_Cost.Location = new System.Drawing.Point(271, 104);
            this.lblUnit_Cost.Name = "lblUnit_Cost";
            this.lblUnit_Cost.Size = new System.Drawing.Size(34, 13);
            this.lblUnit_Cost.TabIndex = 15;
            this.lblUnit_Cost.Text = "---------";
            this.lblUnit_Cost.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold);
            this.label3.ForeColor = System.Drawing.Color.SaddleBrown;
            this.label3.Location = new System.Drawing.Point(206, 104);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(65, 13);
            this.label3.TabIndex = 14;
            this.label3.Text = "Unit Cost";
            // 
            // lblCost
            // 
            this.lblCost.AutoSize = true;
            this.lblCost.Location = new System.Drawing.Point(127, 129);
            this.lblCost.Name = "lblCost";
            this.lblCost.Size = new System.Drawing.Size(34, 13);
            this.lblCost.TabIndex = 17;
            this.lblCost.Text = "---------";
            this.lblCost.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold);
            this.label5.ForeColor = System.Drawing.Color.SaddleBrown;
            this.label5.Location = new System.Drawing.Point(92, 127);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(35, 13);
            this.label5.TabIndex = 16;
            this.label5.Text = "Cost";
            // 
            // ActivityBalloon
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.BackColor = System.Drawing.Color.Gainsboro;
            this.ClientSize = new System.Drawing.Size(376, 328);
            this.Controls.Add(this.lblCost);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.lblUnit_Cost);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.Header);
            this.Controls.Add(this.txtComments);
            this.Controls.Add(this.lblJob);
            this.Controls.Add(this.label10);
            this.Controls.Add(this.label8);
            this.Controls.Add(this.lblDate);
            this.Controls.Add(this.label6);
            this.Controls.Add(this.lblStatus);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.lblUnit);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.lblGoods);
            this.Controls.Add(this.Tags);
            this.FadeAmount = 0.9;
            this.FrameBottomRight = System.Drawing.Color.DimGray;
            this.FrameTopLeft = System.Drawing.Color.Gray;
            this.Location = new System.Drawing.Point(120, 200);
            this.MinimumSize = new System.Drawing.Size(50, 60);
            this.Name = "ActivityBalloon";
            this.tailOffset = 5;
            this.Load += new System.EventHandler(this.ActivityBalloon_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        #endregion

        private void linkLabel2_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            Point p = new Point(Location.X, Location.Y);
            p.Offset(5, 5);
            this.Location = p;
        }

        private void ActivityBalloon_Load(object sender, EventArgs e)
        {
            DataRow[] rows = MainForm.data.Tables[0].Select(" Transaction_ID = " + ID.ToString());

            if (rows.Length == 0)
                this.Close();
            
            lblDate.Text = rows[0]["Date_Time"].ToString();
            lblGoods.Text = MainForm.dsData.Tables["Goods"].Select("Goods_ID = " + rows[0]["Goods_ID"].ToString())[0]["Name"].ToString(); //  rows[0]["Goods_ID"].ToString();

            lblStatus.Text = rows[0]["Transaction_Status_ID"].ToString() ;

            string unit_ID = MainForm.dsData.Tables["Goods"].Select("Goods_ID = " + rows[0]["Goods_ID"].ToString())[0]["Goods_Unit_ID"].ToString();
            string unit = MainForm.dsData.Tables["Goods_Unit"].Select(" Goods_Unit_ID = " + unit_ID)[0]["Goods_Unit_Name"].ToString();  // 


            lblUnit.Text = rows[0]["Unit"].ToString() + " " + unit;
            lblCost.Text = string.Format("{0:c}", rows[0]["Cost"]); 
            lblUnit_Cost.Text = string.Format("{0:c}", rows[0]["Unit_Cost"]);

            txtComments.Text = rows[0]["Comments"].ToString();

            if ( !Convert.ToBoolean( rows[0]["Is_Job"] ) )
            {
                lblJob.Text = "##########";
            }
            else
            {
                lblJob.Text = rows[0]["Job_ID"].ToString();
            }


            if (Convert.ToBoolean(rows[0]["Is_Raw_Material"]))
            {
                Tags.Text = "Raw Material";
                // Incomming Expected Fullfilled
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 1 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 7)
                {
                    lblStatus.Text = "Incomming Expected Fullfilled";
                }

                // Incomming Expected
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 1 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 2)
                {
                    lblStatus.Text = "Raw Material in Transit";
                    Header.Text = "Raw Material in Transit";
                    Header.BackColor = Color.Orange;
                    Header.ForeColor = Color.White;
                    
                }

                // Incomming Current
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 1 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 1)
                {
                    lblStatus.Text = "Current Stock";
                    Header.Text = "Current Stock";
                    Header.BackColor = Color.Green;
                    Header.ForeColor = Color.White;
                    
                }

                // outgoing Expected 
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 2 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 2)
                {
                    lblStatus.Text = "Reserve for job";
                    Header.Text = "Reserve for Pending Job";
                    Header.BackColor = Color.DarkBlue;
                    Header.ForeColor = Color.White;
                }

                // outgoing Expected Fullfilled
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 2 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 7)
                {
                    lblStatus.Text = "outgoing Expected Fullfilled";
                    Header.Text = "Received Stock";
                    Header.BackColor = Color.Green;
                    Header.ForeColor = Color.White;
                }

                // outgoing In-Process
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 2 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 3)
                {
                    lblStatus.Text = "In Manufactureing Phase";
                    Header.Text = "In Manufactureing Phase";
                    Header.BackColor = Color.Yellow;
                    Header.ForeColor = Color.Black;
                }

                // Outgoing Finished
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 2 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 5)
                {
                    lblStatus.Text = "In QA Phase";
                    Header.Text = "In QA Phase";
                    Header.BackColor = Color.Black;
                    Header.ForeColor = Color.White;
                }

                // Outgoing Waste
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 2 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 6)
                {
                    lblStatus.Text = "Waste";
                    Header.Text = "Waste";
                    Header.BackColor = Color.Red;
                    Header.ForeColor = Color.White;
                }

            }
            else
            {
                Tags.Text = "Finished Goods";
                // Incomming Expected Fullfilled
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 1 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 7)
                {
                    lblStatus.Text = "Incomming Expected Fullfilled";
                    // slotArray[i].color =// Color.Green;
                }

                // Incomming Expected
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 1 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 2)
                {
                    lblStatus.Text = "Pending Phase";
                    Header.Text = "In Pending Phase";
                    Header.BackColor = Color.Orange;
                    Header.ForeColor = Color.White;
                }

                // Incomming Current
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 1 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 1)
                {
                    lblStatus.Text = "Received Stock";
                    Header.Text = "Received Stock";
                    Header.BackColor = Color.Green;
                    Header.ForeColor = Color.White;
                }

                // Incomming In-Process
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 1 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 3)
                {
                    lblStatus.Text = "In Manufacturing Phase";
                    Header.Text = "In Manufacturing Phase";
                    Header.BackColor = Color.Yellow;
                    Header.ForeColor = Color.Black;
                }

                // Incomming Sale
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 1 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 4)
                {
                    lblStatus.Text = "Sales Return";
                    Header.Text = "Sales Return";
                    Header.BackColor = Color.DarkBlue;
                    Header.ForeColor = Color.White;
                }

                // outgoing Sale
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 2 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 4)
                {
                    lblStatus.Text = "Sale";
                    Header.Text = "Sale";
                    Header.BackColor = Color.RoyalBlue;
                    Header.ForeColor = Color.White;
                }

                // outgoing Expected 
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 2 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 2)
                {
                    lblStatus.Text = "Reserve for Dispatch";
                    Header.Text = "Reserve for Dispatch";
                    Header.BackColor = Color.DimGray;
                    Header.ForeColor = Color.White;
                }

                // outgoing Expected Fullfilled
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 2 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 7)
                {
                    lblStatus.Text = "Current Stock";
                    Header.Text = "Current Stock";
                    Header.BackColor = Color.Green;
                    Header.ForeColor = Color.White;
                }

                // Outgoing Waste
                if (Convert.ToInt32(rows[0]["Transaction_Type_ID"]) == 2 && Convert.ToInt32(rows[0]["Transaction_Status_ID"]) == 6)
                {
                    lblStatus.Text = "Wastage";
                    Header.Text = "Wastage";
                    Header.BackColor = Color.Red;
                    Header.ForeColor = Color.White;
                }
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Pakistan Pakistan
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
This is a Organisation

33 members

Comments and Discussions