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 partial class GoodsBalloon : 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 System.ComponentModel.IContainer components = null;
int ID = 0;
string m_Filter;
Bars m_Bar;
private Hasan.CustomLabel Header;
Color statusColor;
DataRow[] m_rows;
public GoodsBalloon()
{
// This call is required by the Windows Form Designer.
InitializeComponent();
}
public GoodsBalloon(int id, Color col, DataRow[] rows)
{
// This call is required by the Windows Form Designer.
InitializeComponent();
ID = id;
statusColor = col;
m_rows = rows;
}
public GoodsBalloon(string filter, Bars sche, Color col,DataRow[] rows)
{
// This call is required by the Windows Form Designer.
InitializeComponent();
m_Filter = filter;
m_Bar = sche;
statusColor = col;
m_rows = rows;
FrameBottomRight = statusColor;
}
/// <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.Header = new Hasan.CustomLabel();
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(59, 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(143, 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(143, 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(112, 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(143, 128);
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(97, 128);
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.Location = new System.Drawing.Point(143, 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(108, 152);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(37, 13);
this.label6.TabIndex = 6;
this.label6.Text = "Date";
//
// 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(39, 32);
this.Header.Name = "Header";
this.Header.Size = new System.Drawing.Size(267, 26);
this.Header.TabIndex = 8;
this.Header.Text = "Status";
this.Header.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// GoodsBalloon
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.Gainsboro;
this.ClientSize = new System.Drawing.Size(345, 227);
this.Controls.Add(this.Header);
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 = "GoodsBalloon";
this.tailOffset = 5;
this.Load += new System.EventHandler(this.GoodsBalloon_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 GoodsBalloon_Load(object sender, EventArgs e)
{
DataRow[] rows_l = MainForm.data.Tables[0].Select(m_Filter);
//if (rows_l.Length == 0)
// this.Close();
if (rows_l.Length == 0)
rows_l = m_rows;
int perspective_ID = m_Bar.Perspective_ID;
int option_ID = m_Bar.Option_ID;
string unit_ID = MainForm.dsData.Tables["Goods"].Select("Goods_ID = " + rows_l[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(); //
string goods_Name = "";
switch (perspective_ID)
{
case 0:
if (statusColor == Color.Green)
{
lblUnit.Text = Convert.ToString(Convert.ToInt32(rows_l[0]["Incomming_Current"])
- Convert.ToInt32(rows_l[0]["Outgoing_InProcess"]) //- Convert.ToInt32(rows_l[0]["Outgoing_Expected"])
- Convert.ToInt32(rows_l[0]["Outgoing_Waste"])) + " " + unit;
lblStatus.Text = "Current Stock";
Header.Text = "Current Stock";
Header.BackColor = Color.Green;
Header.ForeColor = Color.White;
}
// Incomming Expected
if (statusColor == Color.Orange)
{
lblUnit.Text = rows_l[0]["Incomming_Expected"].ToString() + " " + unit;
lblStatus.Text = "Raw Material in Transit";
Header.Text = "Raw Material in Transit";
Header.BackColor = Color.Orange;
Header.ForeColor = Color.White;
}
// Outgoing Expected
if (statusColor == Color.DarkBlue )
{
lblUnit.Text = rows_l[0]["Outgoing_Expected"].ToString() + " " + unit;
lblStatus.Text = "Reserve for Pending Job";
Header.Text = "Reserve for Pending Job";
Header.BackColor = Color.DarkBlue;
Header.ForeColor = Color.White;
}
// Outgoing In-Process
if (statusColor == Color.Yellow )
{
lblUnit.Text = rows_l[0]["Outgoing_InProcess"].ToString() + " " + unit;
lblStatus.Text = "In Manufactureing Phase";
Header.Text = "In Manufactureing Phase";
Header.BackColor = Color.Yellow;
Header.ForeColor = Color.Black;
}
break;
case 2:
if (statusColor == Color.Green)
{
lblUnit.Text = Convert.ToString(Convert.ToInt32(rows_l[0]["Incomming_Current"])
- Convert.ToInt32(rows_l[0]["Outgoing_InProcess"]) //- Convert.ToInt32(rows_l[0]["Outgoing_Expected"])
- Convert.ToInt32(rows_l[0]["Outgoing_Waste"])) + " " + unit;
lblStatus.Text = "Current Stock";
Header.Text = "Current Stock";
Header.BackColor = Color.Green;
Header.ForeColor = Color.White;
}
// Incomming Expected
if (statusColor == Color.Orange)
{
lblUnit.Text = rows_l[0]["Incomming_Expected"].ToString() + " " + unit;
lblStatus.Text = "In Pending Phase";
Header.Text = "In Pending Phase";
Header.BackColor = Color.Orange;
Header.ForeColor = Color.White;
}
// Outgoing Expected
if (statusColor == Color.DimGray)
{
lblUnit.Text = rows_l[0]["Outgoing_Expected"].ToString() + " " + unit;
lblStatus.Text = "Reserve for Dispatch";
Header.Text = "Reserve for Dispatch";
Header.BackColor = Color.DimGray;
Header.ForeColor = Color.White;
}
// Incomming In-Process
if (statusColor == Color.Yellow)
{
lblUnit.Text = rows_l[0]["Incomming_InProcess"].ToString() + " " + unit;
lblStatus.Text = "In Manufacturing Phase";
Header.Text = "In Manufacturing Phase";
Header.BackColor = Color.Yellow;
Header.ForeColor = Color.Black;
}
break;
}
lblGoods.Text = MainForm.dsData.Tables["Goods"].Select("Goods_ID = " + rows_l[0]["Goods_ID"].ToString())[0]["Name"].ToString(); //
lblDate.Text = DateTime.Parse( rows_l[0][0].ToString() ).ToShortDateString();
}
}
}