10760 lines
465 KiB
C#
10760 lines
465 KiB
C#
using GMap.NET;
|
|
using GMap.NET.MapProviders;
|
|
using GMap.NET.WindowsForms;
|
|
using Mip.Models;
|
|
using MonthCalendar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Diagnostics;
|
|
using System.Drawing;
|
|
using System.Globalization;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Management;
|
|
using System.Net;
|
|
using System.Net.Sockets;
|
|
using System.Windows.Forms;
|
|
using Excel = Microsoft.Office.Interop.Excel;
|
|
|
|
namespace Mip
|
|
{
|
|
|
|
public partial class frmMain : Form
|
|
{
|
|
|
|
//bool odblokuj=false;
|
|
int rowIndex = -1;
|
|
public string SelectedIds { get; private set; } = string.Empty;
|
|
public string SelectedZiadankaGridIds { get; private set; }
|
|
public bool ReloadSelected { get; private set; } = true;
|
|
|
|
public Queue<string> FilterQueue { get; private set; } = new Queue<string>(2);
|
|
|
|
public frmMain()
|
|
{
|
|
InitializeComponent();
|
|
|
|
tabSpecifikaciaMain.Columns.Add("IDSpec", typeof(System.Int32));
|
|
tabSpecifikaciaMain.Columns.Add("Názov špecifikácie", typeof(System.String));
|
|
tabSpecifikaciaMain.Columns.Add("Dáta špecifikácie", typeof(System.String));
|
|
tabSpecifikaciaMain.Columns.Add("Brúsiteľný", typeof(System.Boolean));
|
|
tabSpecifikaciaMain.Columns.Add("Vymazaný", typeof(System.Boolean));
|
|
}
|
|
|
|
#region kalkulacka
|
|
|
|
private void button5_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send(((Control)sender).Text.ToString());
|
|
}
|
|
|
|
private void button7_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send(((Control)sender).Text.ToString());
|
|
}
|
|
|
|
private void button8_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send(((Control)sender).Text.ToString());
|
|
}
|
|
|
|
private void button15_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send(((Control)sender).Text.ToString());
|
|
}
|
|
|
|
private void button14_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send(((Control)sender).Text.ToString());
|
|
}
|
|
|
|
private void button13_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send(((Control)sender).Text.ToString());
|
|
}
|
|
|
|
private void button20_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send(((Control)sender).Text.ToString());
|
|
}
|
|
|
|
private void button19_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send(((Control)sender).Text.ToString());
|
|
}
|
|
|
|
private void button18_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send(((Control)sender).Text.ToString());
|
|
}
|
|
|
|
private void button25_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send(((Control)sender).Text.ToString());
|
|
}
|
|
|
|
private void button24_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send(((Control)sender).Text.ToString());
|
|
}
|
|
|
|
private void button23_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send(((Control)sender).Text.ToString());
|
|
}
|
|
|
|
private void button22_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send("{+}");
|
|
}
|
|
|
|
private void button17_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send(((Control)sender).Text.ToString());
|
|
}
|
|
|
|
private void button12_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send(((Control)sender).Text.ToString());
|
|
}
|
|
|
|
private void button9_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send(((Control)sender).Text.ToString());
|
|
}
|
|
|
|
private void button11_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send("{(}");
|
|
}
|
|
|
|
private void button16_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send("{)}");
|
|
}
|
|
|
|
private void button26_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
if (textBox1.SelectedText.Length == 0)
|
|
{
|
|
textBox1.Text = "(" + textBox1.Text + ")";
|
|
}
|
|
else
|
|
{
|
|
textBox1.SelectedText = "(" + textBox1.SelectedText + ")";
|
|
}
|
|
|
|
}
|
|
|
|
private void button31_Click(object sender, EventArgs e)
|
|
{
|
|
//textBox1.Text = textBox1.Text.Substring(0, textBox1.Text.Length - 1);
|
|
//textBox1.Text = textBox1.Text.Insert(textBox1.SelectionStart, System.ConsoleKey.Backspace.ToString() );
|
|
textBox1.Focus();
|
|
SendKeys.Send("{BS}");
|
|
}
|
|
|
|
private void button10_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Text = "";
|
|
label7.Text = "";
|
|
}
|
|
|
|
private void button38_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send("3.14159");
|
|
}
|
|
|
|
private void button21_Click(object sender, EventArgs e)
|
|
{
|
|
string strBack;
|
|
classSQL.SQL("SELECT " + textBox1.Text.ToString().Replace(",", ".") + ";", out strBack);
|
|
|
|
label7.Text = strBack;
|
|
}
|
|
|
|
private void button32_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
SendKeys.Send("{DEL}");
|
|
}
|
|
|
|
private void panel1_Leave(object sender, EventArgs e)
|
|
{
|
|
/*panel1.Size = new Size(14, 134);
|
|
panel1.Location = new Point(this.Size.Width - 30, panel1.Location.Y);
|
|
*/
|
|
}
|
|
|
|
private void button41_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
if (textBox1.SelectedText.Length == 0)
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (POWER (" + textBox1.Text.ToString().Replace(",", ".") + ", 2),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
textBox1.Text = "";
|
|
SendKeys.Send(strBack);
|
|
textBox1.SelectionStart = textBox1.Text.Length;
|
|
}
|
|
else
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (POWER (" + textBox1.SelectedText.ToString().Replace(",", ".") + ", 2),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
SendKeys.Send(strBack);
|
|
}
|
|
}
|
|
|
|
private void button37_Click(object sender, EventArgs e)
|
|
{
|
|
if (button37.UseVisualStyleBackColor == true)
|
|
{
|
|
button37.BackColor = Color.DarkGray;
|
|
button37.UseVisualStyleBackColor = false;
|
|
}
|
|
else
|
|
{
|
|
button37.BackColor = default(Color);
|
|
button37.UseVisualStyleBackColor = true;
|
|
}
|
|
|
|
}
|
|
|
|
private void button40_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
if (textBox1.SelectedText.Length == 0)
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (POWER (" + textBox1.Text.ToString().Replace(",", ".") + ", 3),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
textBox1.Text = "";
|
|
SendKeys.Send(strBack);
|
|
textBox1.SelectionStart = textBox1.Text.Length;
|
|
}
|
|
else
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (POWER (" + textBox1.SelectedText.ToString().Replace(",", ".") + ", 3),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
SendKeys.Send(strBack);
|
|
}
|
|
}
|
|
|
|
private void button35_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
if (textBox1.SelectedText.Length == 0)
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (POWER (" + textBox1.Text.ToString().Replace(",", ".") + ", 0.5),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
textBox1.Text = "";
|
|
SendKeys.Send(strBack);
|
|
textBox1.SelectionStart = textBox1.Text.Length;
|
|
}
|
|
else
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (POWER (" + textBox1.SelectedText.ToString().Replace(",", ".") + ", 0.5),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
SendKeys.Send(strBack);
|
|
}
|
|
|
|
}
|
|
|
|
private void button34_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
if (textBox1.SelectedText.Length == 0)
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (POWER (" + textBox1.Text.ToString().Replace(",", ".") + ", 1/3),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
textBox1.Text = "";
|
|
SendKeys.Send(strBack);
|
|
textBox1.SelectionStart = textBox1.Text.Length;
|
|
}
|
|
else
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (POWER (" + textBox1.SelectedText.ToString().Replace(",", ".") + ", 1/3),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
SendKeys.Send(strBack);
|
|
}
|
|
}
|
|
|
|
private void button27_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
if (button37.UseVisualStyleBackColor == true)
|
|
{
|
|
if (textBox1.SelectedText.Length == 0)
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (SIN (PI()*(" + textBox1.Text.ToString().Replace(",", ".") + ")/180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
textBox1.Text = "";
|
|
SendKeys.Send(strBack);
|
|
textBox1.SelectionStart = textBox1.Text.Length;
|
|
}
|
|
else
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (SIN (PI()*(" + textBox1.SelectedText.ToString().Replace(",", ".") + ")/180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
SendKeys.Send(strBack);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (textBox1.SelectedText.Length == 0)
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND ((ASIN(" + textBox1.Text.ToString().Replace(",", ".") + ")/PI()*180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
textBox1.Text = "";
|
|
SendKeys.Send(strBack);
|
|
textBox1.SelectionStart = textBox1.Text.Length;
|
|
button37.BackColor = default(Color);
|
|
button37.UseVisualStyleBackColor = true;
|
|
|
|
}
|
|
else
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND ((ASIN(" + textBox1.SelectedText.ToString().Replace(",", ".") + ")/PI()*180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
SendKeys.Send(strBack);
|
|
button37.BackColor = default(Color);
|
|
button37.UseVisualStyleBackColor = true;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private void button28_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
if (button37.UseVisualStyleBackColor == true)
|
|
{
|
|
if (textBox1.SelectedText.Length == 0)
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (COS (PI()*(" + textBox1.Text.ToString().Replace(",", ".") + ")/180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
textBox1.Text = "";
|
|
SendKeys.Send(strBack);
|
|
textBox1.SelectionStart = textBox1.Text.Length;
|
|
}
|
|
else
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (COS (PI()*(" + textBox1.SelectedText.ToString().Replace(",", ".") + ")/180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
SendKeys.Send(strBack);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (textBox1.SelectedText.Length == 0)
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND ((ACOS(" + textBox1.Text.ToString().Replace(",", ".") + ")/PI()*180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
textBox1.Text = "";
|
|
SendKeys.Send(strBack);
|
|
textBox1.SelectionStart = textBox1.Text.Length;
|
|
button37.BackColor = default(Color);
|
|
button37.UseVisualStyleBackColor = true;
|
|
|
|
}
|
|
else
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND ((ACOS(" + textBox1.SelectedText.ToString().Replace(",", ".") + ")/PI()*180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
SendKeys.Send(strBack);
|
|
button37.BackColor = default(Color);
|
|
button37.UseVisualStyleBackColor = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void button29_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
if (button37.UseVisualStyleBackColor == true)
|
|
{
|
|
if (textBox1.SelectedText.Length == 0)
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (TAN (PI()*(" + textBox1.Text.ToString().Replace(",", ".") + ")/180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
textBox1.Text = "";
|
|
SendKeys.Send(strBack);
|
|
textBox1.SelectionStart = textBox1.Text.Length;
|
|
}
|
|
else
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (TAN (PI()*(" + textBox1.SelectedText.ToString().Replace(",", ".") + ")/180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
SendKeys.Send(strBack);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (textBox1.SelectedText.Length == 0)
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND ((ATAN(" + textBox1.Text.ToString().Replace(",", ".") + ")/PI()*180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
textBox1.Text = "";
|
|
SendKeys.Send(strBack);
|
|
textBox1.SelectionStart = textBox1.Text.Length;
|
|
button37.BackColor = default(Color);
|
|
button37.UseVisualStyleBackColor = true;
|
|
|
|
}
|
|
else
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND ((ATAN(" + textBox1.SelectedText.ToString().Replace(",", ".") + ")/PI()*180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
SendKeys.Send(strBack);
|
|
button37.BackColor = default(Color);
|
|
button37.UseVisualStyleBackColor = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void button30_Click(object sender, EventArgs e)
|
|
{
|
|
textBox1.Focus();
|
|
if (button37.UseVisualStyleBackColor == true)
|
|
{
|
|
if (textBox1.SelectedText.Length == 0)
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (COT (PI()*(" + textBox1.Text.ToString().Replace(",", ".") + ")/180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
textBox1.Text = "";
|
|
SendKeys.Send(strBack);
|
|
textBox1.SelectionStart = textBox1.Text.Length;
|
|
}
|
|
else
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND (COT (PI()*(" + textBox1.SelectedText.ToString().Replace(",", ".") + ")/180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
SendKeys.Send(strBack);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (textBox1.SelectedText.Length == 0)
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND ((ATAN (1/(" + textBox1.Text.ToString().Replace(",", ".") + "))/PI()*180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
textBox1.Text = "";
|
|
SendKeys.Send(strBack);
|
|
textBox1.SelectionStart = textBox1.Text.Length;
|
|
button37.BackColor = default(Color);
|
|
button37.UseVisualStyleBackColor = true;
|
|
|
|
}
|
|
else
|
|
{
|
|
string strBack;
|
|
string cmd = "SELECT ROUND ((ATAN (1/(" + textBox1.SelectedText.ToString().Replace(",", ".") + "))/PI()*180),5);";
|
|
classSQL.SQL(cmd, out strBack);
|
|
|
|
SendKeys.Send(strBack);
|
|
button37.BackColor = default(Color);
|
|
button37.UseVisualStyleBackColor = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void pictureBox1_Click(object sender, EventArgs e)
|
|
{
|
|
panel1.Size = new Size(300, 300);
|
|
panel1.Location = new Point(this.Size.Width - 345, panel1.Location.Y);
|
|
label6_Click(null, null);
|
|
|
|
textBox1.Focus();
|
|
}
|
|
|
|
private void label5_Click(object sender, EventArgs e)
|
|
{
|
|
panel1.Size = new Size(36, 35);
|
|
panel1.Location = new Point(this.Size.Width - 45, panel1.Location.Y);
|
|
}
|
|
|
|
#endregion kalkulacka // //fd
|
|
|
|
private void pictureBox4_Click(object sender, EventArgs e)
|
|
{
|
|
panel68.Size = new Size(311, 167);
|
|
panel68.Location = new Point(this.Size.Width - 356, panel68.Location.Y);
|
|
//label182_Click(null, null);
|
|
|
|
//textBox1.Focus();
|
|
}
|
|
|
|
#region kalendar
|
|
|
|
private void pictureBox2_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel5.Visible) panel5.Visible = false;
|
|
panel2.Size = new Size(236, 190);
|
|
panel2.Location = new Point(this.Size.Width - 281, panel2.Location.Y);
|
|
label5_Click(null, null);
|
|
|
|
DateTime dateforkal = DateTime.Today;
|
|
monthCalendar1.SelectedDate = dateforkal;
|
|
kalendarRefresh();
|
|
}
|
|
|
|
|
|
private void kalendarRefresh()
|
|
{
|
|
|
|
DataTable dttblKal;
|
|
classSQL.SQL("SELECT * FROM `tabkalendar` WHERE `IDuser` =" + classUser.ID.ToString() + " AND `StatusPoznamky` != 'Vymazaná';", out dttblKal);
|
|
DataRow drwKal;
|
|
|
|
DateItem[] d = new DateItem[dttblKal.Rows.Count];
|
|
|
|
for (int i = 0; i < dttblKal.Rows.Count; i++)
|
|
{
|
|
drwKal = dttblKal.Rows[i];
|
|
d[i] = new DateItem();
|
|
if (drwKal["StatusPoznamky"].ToString() == "Neprečítaná")
|
|
{
|
|
DateTime date = (DateTime)drwKal["DatumPoznamky"];
|
|
Int32 intYear = Convert.ToInt32(date.Year.ToString());
|
|
Int32 intMonth = Convert.ToInt32(date.Month.ToString());
|
|
Int32 intDay = Convert.ToInt32(date.Day.ToString());
|
|
|
|
d[i].Date = new DateTime(intYear, intMonth, intDay);
|
|
d[i].Background.Style = MonthCalendar.EStyle.esGradient;
|
|
d[i].Background.StartColor = Color.Goldenrod;
|
|
d[i].Background.EndColor = Color.FloralWhite;
|
|
d[i].Background.Gradient = MonthCalendar.GradientStyle.Vertical;
|
|
d[i].Border.BorderColor = Color.Gray;
|
|
d[i].Border.Visible = true;
|
|
d[i].DayAlign = ContentAlignment.MiddleCenter;
|
|
monthCalendar1.Dates.Add(d[i]);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel6.Visible == false)
|
|
{
|
|
panel6.Visible = true;
|
|
panel2.Size = new Size(panel2.Width, 294);
|
|
label6.Location = new Point(label6.Location.X, 268);
|
|
label8.Text = "Poznámka na deň: " + monthCalendar1.SelectedDate.ToShortDateString();
|
|
}
|
|
else
|
|
{
|
|
panel6.Visible = false;
|
|
panel2.Size = new Size(panel2.Width, 190);
|
|
label6.Location = new Point(label6.Location.X, 164);
|
|
}
|
|
|
|
}
|
|
|
|
private void button49_Click(object sender, EventArgs e)
|
|
{
|
|
panel6.Visible = false;
|
|
panel2.Size = new Size(panel2.Width, 190);
|
|
label6.Location = new Point(label6.Location.X, 164);
|
|
textBox2.Text = "";
|
|
}
|
|
|
|
private void button48_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
string cmd;
|
|
string format = "yyyy-MM-dd";
|
|
string DatumPoznamky = "";
|
|
|
|
DatumPoznamky = monthCalendar1.SelectedDate.ToString(format);
|
|
|
|
cmd = @"INSERT INTO `mip`.`tabkalendar` (`IDuser`, `DatumPoznamky`, `DatumPridania`, `StatusPoznamky`, `TextPoznamky`)
|
|
VALUES ("
|
|
+ classUser.ID.ToString() + ", '"
|
|
+ DatumPoznamky + "', "
|
|
+ "DATE(NOW()), '"
|
|
+ "Neprečítaná" + "', '"
|
|
+ textBox2.Text.ToString() + "');";
|
|
|
|
classSQL.SQL(cmd);
|
|
panel6.Visible = false;
|
|
panel2.Size = new Size(panel2.Width, 190);
|
|
label6.Location = new Point(label6.Location.X, 164);
|
|
textBox2.Text = "";
|
|
kalendarRefresh();
|
|
|
|
}
|
|
|
|
private void textBox2_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (textBox2.Text == "") button48.Enabled = false;
|
|
else button48.Enabled = true;
|
|
}
|
|
|
|
private void label6_Click(object sender, EventArgs e)
|
|
{
|
|
panel2.Size = new Size(36, 35);
|
|
panel6.Visible = false;
|
|
panel2.Location = new Point(this.Size.Width - 45, panel2.Location.Y);
|
|
removePanels();
|
|
}
|
|
|
|
|
|
|
|
int i = 0;
|
|
DataTable dttblPoznamkyNaDen;
|
|
private void monthCalendar1_SelectDay(object sender, MonthCalendar.SelectDayEventArgs e)
|
|
{
|
|
label8.Text = "Poznámka na deň: " + e.Date.ToShortDateString();
|
|
|
|
removePanels();
|
|
vypisPoznamky();
|
|
|
|
}
|
|
private void vypisPoznamky()
|
|
{
|
|
string format = "yyyy-MM-dd";
|
|
string datum = monthCalendar1.SelectedDate.Date.ToString(format);
|
|
|
|
string commd = "SELECT COUNT(*) FROM `tabkalendar` where `IDUser` = " + classUser.ID.ToString() + " AND `DatumPoznamky` = '" + datum + "' AND `StatusPoznamky` != 'Vymazaná';";
|
|
string strBack;
|
|
classSQL.SQL(commd, out strBack);
|
|
int intPocetZaznamov = Convert.ToInt16(strBack);
|
|
label11.Text = strBack;
|
|
|
|
classSQL.SQL("SELECT * FROM `tabkalendar` where `IDUser` = " + classUser.ID.ToString() + " AND `DatumPoznamky` = '" + datum + "' AND `StatusPoznamky` != 'Vymazaná';", out dttblPoznamkyNaDen);
|
|
dttblPoznamkyNaDen.Columns.Add("indexSender");
|
|
|
|
Panel[] pCislo = new Panel[intPocetZaznamov];
|
|
Panel[] pPoznamka = new Panel[intPocetZaznamov];
|
|
Label[] lCislo = new Label[intPocetZaznamov];
|
|
Label[] lPoznamka = new Label[intPocetZaznamov];
|
|
|
|
for (i = 0; i < intPocetZaznamov; i++)
|
|
{
|
|
|
|
|
|
DataRow drKal = dttblPoznamkyNaDen.Rows[i];
|
|
drKal["indexSender"] = i;
|
|
|
|
pCislo[i] = new Panel();
|
|
pCislo[i].Size = new Size(25, 21);
|
|
pCislo[i].Location = new Point(panel2.Location.X - 26, panel2.Location.Y + (i * 22));
|
|
pCislo[i].Visible = true;
|
|
pCislo[i].Anchor = (AnchorStyles.Right | AnchorStyles.Top);
|
|
pCislo[i].Name = "pCislo" + i.ToString();
|
|
pCislo[i].BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
lCislo[i] = new Label();
|
|
lCislo[i].Click += new EventHandler(ClickEvent);
|
|
lCislo[i].AutoSize = false;
|
|
lCislo[i].Text = (i + 1).ToString();
|
|
lCislo[i].Size = new Size(25, 21);
|
|
lCislo[i].TextAlign = ContentAlignment.MiddleCenter;
|
|
lCislo[i].Location = new Point(0, 0);
|
|
|
|
if (drKal["StatusPoznamky"].ToString() == "Neprečítaná") lCislo[i].BackColor = Color.Gold;
|
|
if (drKal["StatusPoznamky"].ToString() == "Prečítaná") lCislo[i].BackColor = Color.LightGreen;
|
|
if (drKal["StatusPoznamky"].ToString() == "Vymazaná") lCislo[i].BackColor = Color.LightGray;
|
|
|
|
lCislo[i].Font = new Font(lCislo[i].Font.Name, 10);
|
|
pCislo[i].Controls.Add(lCislo[i]);
|
|
this.Controls.Add(pCislo[i]);
|
|
pCislo[i].BringToFront();
|
|
|
|
lPoznamka[i] = new Label();
|
|
lPoznamka[i].AutoSize = true;
|
|
lPoznamka[i].Text = drKal["TextPoznamky"].ToString();
|
|
lPoznamka[i].BackColor = Color.Black;
|
|
if (drKal["StatusPoznamky"].ToString() == "Neprečítaná")
|
|
{
|
|
lPoznamka[i].ForeColor = Color.Gold;
|
|
lPoznamka[i].Font = new Font(lPoznamka[i].Font.Name, 10, FontStyle.Bold);
|
|
}
|
|
if (drKal["StatusPoznamky"].ToString() == "Prečítaná")
|
|
{
|
|
lPoznamka[i].ForeColor = Color.Gold;
|
|
lPoznamka[i].Font = new Font(lPoznamka[i].Font.Name, 10, FontStyle.Regular);
|
|
}
|
|
if (drKal["StatusPoznamky"].ToString() == "Vymazaná")
|
|
{
|
|
lPoznamka[i].ForeColor = Color.Gray;
|
|
lPoznamka[i].Font = new Font(lPoznamka[i].Font.Name, 10, FontStyle.Italic);
|
|
}
|
|
lPoznamka[i].Location = new Point(1, 1);
|
|
lPoznamka[i].Refresh();
|
|
pPoznamka[i] = new Panel();
|
|
pPoznamka[i].Controls.Add(lPoznamka[i]);
|
|
pPoznamka[i].Size = new Size(lPoznamka[i].Size.Width + 2, 21);
|
|
pPoznamka[i].Location = new Point(pCislo[i].Location.X - pPoznamka[i].Size.Width - 1, panel2.Location.Y + (i * 22));
|
|
pPoznamka[i].Visible = true;
|
|
pPoznamka[i].Anchor = (AnchorStyles.Right | AnchorStyles.Top);
|
|
pPoznamka[i].Name = "pPoznamka" + i.ToString();
|
|
pPoznamka[i].BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
this.Controls.Add(pPoznamka[i]);
|
|
pPoznamka[i].BringToFront();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void pBDelete_Click(object sender, EventArgs e)
|
|
{
|
|
string commandMarkRead = "UPDATE `mip`.`tabkalendar` SET `StatusPoznamky` = 'Vymazaná' WHERE `IDPoznamky`=" + idpoznamky + ";";
|
|
classSQL.SQL(commandMarkRead);
|
|
removePanels();
|
|
vypisPoznamky();
|
|
kalendarRefresh();
|
|
}
|
|
|
|
private void pBMarkAsRead_Click(object sender, EventArgs e)
|
|
{
|
|
string commandMarkRead = "UPDATE `mip`.`tabkalendar` SET `StatusPoznamky` = 'Prečítaná' WHERE `IDPoznamky`=" + idpoznamky + ";";
|
|
classSQL.SQL(commandMarkRead);
|
|
removePanels();
|
|
vypisPoznamky();
|
|
kalendarRefresh();
|
|
}
|
|
|
|
|
|
private void removePanels()
|
|
{
|
|
for (int j = 0; j < i; j++) this.Controls.RemoveByKey("pPoznamka" + j.ToString());
|
|
for (int j = 0; j < i; j++) this.Controls.RemoveByKey("pCislo" + j.ToString());
|
|
pBDelete.Visible = false;
|
|
pBMarkAsRead.Visible = false;
|
|
}
|
|
|
|
int indexSender;
|
|
Int32 idpoznamky;
|
|
Label nameSender;
|
|
Color colorSender;
|
|
void ClickEvent(object sender, EventArgs e)
|
|
{
|
|
Label label = sender as Label;
|
|
if (nameSender != null) nameSender.BackColor = colorSender;
|
|
|
|
if (label.BackColor == Color.LightGray)
|
|
{
|
|
pBDelete.Visible = false;
|
|
pBMarkAsRead.Visible = false;
|
|
}
|
|
if (label.BackColor == Color.Gold)
|
|
{
|
|
pBDelete.Visible = true;
|
|
pBMarkAsRead.Visible = true;
|
|
}
|
|
if (label.BackColor == Color.LightGreen)
|
|
{
|
|
pBDelete.Visible = true;
|
|
pBMarkAsRead.Visible = false;
|
|
}
|
|
indexSender = Convert.ToInt16(label.Text.ToString()) - 1;
|
|
nameSender = label;
|
|
colorSender = label.BackColor;
|
|
|
|
for (int p = 0; p < dttblPoznamkyNaDen.Rows.Count; p++)
|
|
{
|
|
DataRow dr = dttblPoznamkyNaDen.Rows[p];
|
|
if (dr["indexSender"].ToString() == indexSender.ToString()) idpoznamky = Convert.ToInt32(dr["IDPoznamky"].ToString());
|
|
}
|
|
|
|
label.BackColor = SystemColors.Highlight;
|
|
}
|
|
|
|
#endregion kalendar
|
|
|
|
#region chat
|
|
|
|
private void pictureBox3_Click(object sender, EventArgs e)
|
|
{
|
|
Form frmChat2 = new frmChat();
|
|
|
|
frmChat2.Location = new Point(panel3.Location.X + 12 - frmChat2.Width, panel3.Location.Y + 35);
|
|
|
|
panel4.Visible = false;
|
|
refreshZistiNovuSpravu.Interval = 10000;
|
|
frmChat2.Show();
|
|
|
|
}
|
|
|
|
#endregion chat
|
|
|
|
#region cp a objednavky
|
|
|
|
private void btnNewOBJ_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
Form frmNewEditOBJ2 = new frmNewDopyt();
|
|
frmNewEditOBJ2.ShowDialog();
|
|
check();
|
|
|
|
}
|
|
|
|
private void checkBox2_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
check();
|
|
|
|
}
|
|
|
|
private void checkBox1_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
check();
|
|
}
|
|
|
|
private void checkBox3_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
check();
|
|
}
|
|
|
|
private void check()
|
|
{
|
|
|
|
int scrollBarHeight = 0;
|
|
if (dataGridView1.Controls.OfType<HScrollBar>().First().Visible == true) scrollBarHeight = dataGridView1.Controls.OfType<HScrollBar>().First().Height;
|
|
int headerHeight = dataGridView1.ColumnHeadersHeight;
|
|
if (headerHeight < 25) headerHeight = 47;
|
|
|
|
classSQL.intPocetNaStranu = Convert.ToInt32(Math.Floor((double)((dataGridView1.Height - headerHeight - scrollBarHeight - 2) / 22)));
|
|
if (classSQL.intPocetNaStranu > 1)
|
|
{
|
|
if (dataGridView1.SelectedRows.Count > 0) classUser.IndexDopyt = Convert.ToInt32(dataGridView1[dataGridView1.Columns["IDCPOBJ"].Index, dataGridView1.SelectedRows[0].Index].Value.ToString());
|
|
else classUser.IndexDopyt = 0;
|
|
|
|
string strCheckBoxStatusCondition = " AND(`StatusDopytu` = 'Prázdna hodnota'";
|
|
foreach (CheckBox chb in groupBox19.Controls)
|
|
{
|
|
if (chb.Checked) strCheckBoxStatusCondition = strCheckBoxStatusCondition + " OR `StatusDopytu` = '" + chb.Text + "'";
|
|
}
|
|
strCheckBoxStatusCondition = strCheckBoxStatusCondition + ")";
|
|
|
|
string strCheckBoxTypCondition = " (`TypDopytu` = 'Prázdna hodnota'";
|
|
foreach (CheckBox chb in groupBox3.Controls)
|
|
{
|
|
if (chb.Checked) strCheckBoxTypCondition = strCheckBoxTypCondition + " OR `TypDopytu` = '" + chb.Text + "'";
|
|
}
|
|
strCheckBoxTypCondition = strCheckBoxTypCondition + ")";
|
|
|
|
string strZoradenie = "";
|
|
if (radioButton9.Checked == true) strZoradenie = " ORDER BY `DatumPotvrdeny` ASC, `Zakaznik` ASC, `DatumPrijatiaOBJ` DESC";
|
|
if (radioButton8.Checked == true) strZoradenie = " ORDER BY `IDCPOBJ` DESC";
|
|
|
|
string strTextBoxCondition = "";
|
|
if (DopytColorIndex > 0) strTextBoxCondition = " AND INSTR(`" + dataGridView1.Columns[DopytColorIndex].Name + "`, '" + textBox4.Text + "')>0 ";
|
|
|
|
string sqlCommandDopyty = "SELECT * FROM pohladdopyty WHERE" + strCheckBoxTypCondition + strCheckBoxStatusCondition + strTextBoxCondition + strZoradenie + ";";
|
|
classUser.strLastSelect = sqlCommandDopyty;
|
|
|
|
classUser.boolEnableRowEnter = false; // zablokuje a nedovoli vykonavat ine funkcie, v tomto pripade rowenter event
|
|
|
|
DataTable tbldopyty = new DataTable();
|
|
Int32 StartRecord = (Convert.ToInt32(numericUpDown1.Value) * classSQL.intPocetNaStranu) - classSQL.intPocetNaStranu;
|
|
|
|
classSQL.SQL(sqlCommandDopyty, StartRecord, classSQL.intPocetNaStranu, out tbldopyty);
|
|
dataGridView1.DataSource = tbldopyty;
|
|
|
|
Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
lblStranka.Text = numericUpDown1.Value.ToString() + "/" + PocetStran.ToString();
|
|
if (PocetStran < 1) PocetStran = 1;
|
|
numericUpDown1.Maximum = PocetStran;
|
|
|
|
classUser.boolEnableRowEnter = true; // odblokuje
|
|
|
|
dataGVSetColumnSortMode(dataGridView1, DataGridViewColumnSortMode.NotSortable);
|
|
setDGV(dataGridView1, classUser.IndexDopyt, textBox4);
|
|
}
|
|
/*
|
|
dataGridView1.Visible = true;
|
|
dataGridView1.AutoResizeColumns();
|
|
//dataGridView1.CurrentRow.
|
|
|
|
dataGridView1.ClearSelection();
|
|
if (classUser.IndexDopyt <= dataGridView1.Rows.Count - 1) dataGridView1.Rows[classUser.IndexDopyt].Selected = true;
|
|
else if (dataGridView1.Rows.Count != 0) dataGridView1.Rows[dataGridView1.Rows.Count - 1].Selected = true;
|
|
dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.SelectedRows[0].Index;
|
|
|
|
lblZobrazenyPocet.Text = dataGridView1.Rows.Count.ToString();
|
|
//MessageBox.Show(dataGridView1.SelectedRows[0].Index.ToString());
|
|
*/
|
|
}
|
|
|
|
int DopytColorIndex = -1;
|
|
private void dataGridView1_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
|
|
if (DopytColorIndex != e.ColumnIndex && DopytColorIndex != -1) dataGridView1.Columns[DopytColorIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
|
|
if (dataGridView1.Columns[e.ColumnIndex].DefaultCellStyle.BackColor == Color.Empty)
|
|
{
|
|
dataGridView1.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.GreenYellow;
|
|
DopytColorIndex = e.ColumnIndex;
|
|
textBox4.Text = "";
|
|
textBox4.Enabled = true;
|
|
label19.Text = "Hľadať v stĺpci: " + dataGridView1.Columns[e.ColumnIndex].HeaderText;
|
|
}
|
|
else
|
|
{
|
|
dataGridView1.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
DopytColorIndex = -1;
|
|
textBox4.Text = "";
|
|
textBox4.Enabled = false;
|
|
label19.Text = "Hľadať v stĺpci: ---";
|
|
}
|
|
}
|
|
|
|
private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (classUser.boolEnableRowEnter == true)
|
|
{
|
|
string IDVyrobok = dataGridView1.Rows[e.RowIndex].Cells["IDVyrobok"].Value.ToString();
|
|
string IDCPOBJ = dataGridView1.Rows[e.RowIndex].Cells["IDCPOBJ"].Value.ToString();
|
|
string NazovKontraktu = dataGridView1.Rows[e.RowIndex].Cells["CisloObj"].Value.ToString();
|
|
|
|
if (dataGridView1.Rows[e.RowIndex].Cells["TypDopytu"].Value.ToString() == "Kontrakt")
|
|
{
|
|
splitContainer3.Panel2Collapsed = false;
|
|
DataTable dtGV4 = new DataTable();
|
|
classSQL.SQL("SELECT * FROM pohladdopyty WHERE `IDCPOBJ` = " + IDCPOBJ + ";", out dtGV4);
|
|
DataTable dtGV5 = new DataTable();
|
|
classSQL.SQL("SELECT * FROM pohladdopyty WHERE `NazovKontraktu` = '" + NazovKontraktu + "';", out dtGV5);
|
|
dataGridView5.DataSource = dtGV5;
|
|
|
|
// ziskanie udajov
|
|
Int32 intPocOdKus = 0; Int32 intPocKusVoVyr = 0; Int32 intPocKusNaSklade = 0; Int32 intZosPocKus = 0;
|
|
foreach (DataRow dri in dtGV5.Rows)
|
|
{
|
|
if (dri["TypDopytu"].ToString() == "Call Off" && dri["StatusDopytu"].ToString() == "Odoslaný") intPocOdKus = intPocOdKus + Convert.ToInt32(dri["PocetKusov"].ToString());
|
|
if (dri["TypDopytu"].ToString() == "Objednávka do kontraktu" &&
|
|
(dri["StatusDopytu"].ToString() == "Prijatá" || dri["StatusDopytu"].ToString() == "Zaradená do výroby" || dri["StatusDopytu"].ToString() == "Vo výrobe" || dri["StatusDopytu"].ToString() == "Na lapovni" || dri["StatusDopytu"].ToString() == "Čiastočne odoslaná"))
|
|
intPocKusVoVyr = intPocKusVoVyr + Convert.ToInt32(dri["PocetKusov"].ToString());
|
|
}
|
|
|
|
// vyplnenie udajov
|
|
DataRow Row0 = dtGV4.Rows[0];
|
|
|
|
#region Zisti počet na sklade
|
|
string IDvyrobokPrePocetNaSklade;
|
|
IDvyrobokPrePocetNaSklade = Row0["IDVyrobok"].ToString();
|
|
string strMatUMat;
|
|
if (Row0["UpravaMaterialu"].ToString() == "") strMatUMat = Row0["Material"].ToString();
|
|
else strMatUMat = Row0["Material"].ToString() + " + " + Row0["UpravaMaterialu"].ToString();
|
|
|
|
string cmd = @"SELECT
|
|
IFNULL((SELECT SUM(`tabskladvyrobkov`.Pocet) FROM `tabskladvyrobkov`
|
|
WHERE (`tabskladvyrobkov`.SkladOperacia = 'Príjem' OR `tabskladvyrobkov`.SkladOperacia = 'Inventárny príjem') AND
|
|
`tabskladvyrobkov`.StatusSkladOperacie = 'Vybavený' AND
|
|
`tabskladvyrobkov`.MaterialSUpravouMat = '" + strMatUMat + @"' AND
|
|
`tabskladvyrobkov`.IDvyr = " + IDvyrobokPrePocetNaSklade + @"),0)
|
|
-
|
|
IFNULL((SELECT SUM(`tabskladvyrobkov`.Pocet) FROM `tabskladvyrobkov`
|
|
WHERE (`tabskladvyrobkov`.SkladOperacia = 'Výdaj' OR `tabskladvyrobkov`.SkladOperacia = 'Inventárny výdaj') AND
|
|
(`tabskladvyrobkov`.StatusSkladOperacie = 'Vybavený' OR `tabskladvyrobkov`.StatusSkladOperacie = 'Nevybavený') AND
|
|
`tabskladvyrobkov`.MaterialSUpravouMat = '" + strMatUMat + @"' AND
|
|
`tabskladvyrobkov`.IDvyr = " + IDvyrobokPrePocetNaSklade + @"),0)
|
|
AS `TotalNaSklade`";
|
|
string strBack;
|
|
DataTable TotalNaSklade = new DataTable();
|
|
classSQL.SQL(cmd, out strBack);
|
|
#endregion Zisti počet na sklade
|
|
if (strBack != "") intPocKusNaSklade = Convert.ToInt32(strBack);
|
|
else intPocKusNaSklade = 0;
|
|
|
|
dtGV4.Columns.Add("Počet odoslaných kusov");
|
|
dtGV4.Columns.Add("Počet kusov vo výrobe");
|
|
dtGV4.Columns.Add("Počet kusov na sklade");
|
|
dtGV4.Columns.Add("Zostávajúci počet kusov");
|
|
intZosPocKus = Convert.ToInt32(Row0["PocetKusov"].ToString()) - Convert.ToInt32(Row0["PociatStavKontraktu"].ToString()) - intPocOdKus;
|
|
|
|
Row0["Počet odoslaných kusov"] = Convert.ToInt32(Row0["PociatStavKontraktu"].ToString()) + intPocOdKus;
|
|
Row0["Počet kusov vo výrobe"] = intPocKusVoVyr;
|
|
Row0["Počet kusov na sklade"] = intPocKusNaSklade;
|
|
Row0["Zostávajúci počet kusov"] = intZosPocKus;
|
|
dataGridView4.DataSource = dtGV4;
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
splitContainer3.Panel2Collapsed = true;
|
|
|
|
}
|
|
dataGridView4.ClearSelection();
|
|
dataGridView5.ClearSelection();
|
|
}
|
|
}
|
|
|
|
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
|
{
|
|
classGlobal.SetRowColor(dataGridView1, e.ColumnIndex, e.RowIndex, e.Value.ToString());
|
|
}
|
|
|
|
private void dataGridView4_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
|
{
|
|
classGlobal.SetRowColor(dataGridView4, e.ColumnIndex, e.RowIndex, e.Value.ToString());
|
|
}
|
|
|
|
private void dataGridView5_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
|
{
|
|
classGlobal.SetRowColor(dataGridView5, e.ColumnIndex, e.RowIndex, e.Value.ToString());
|
|
}
|
|
|
|
private void btnTlacitPrednuStranu_Click(object sender, EventArgs e)
|
|
{
|
|
DataGridViewRow dtrw = dataGridView1.SelectedRows[0];
|
|
if (dtrw.Cells["TypDopytu"].Value.ToString() == "Objednávka" || dtrw.Cells["TypDopytu"].Value.ToString() == "Objednávka do kontraktu")
|
|
if (dtrw.Cells["StatusDopytu"].Value.ToString() != "Odoslaná" && dtrw.Cells["StatusDopytu"].Value.ToString() != "Pozastavená" && dtrw.Cells["StatusDopytu"].Value.ToString() != "Zrušená")
|
|
{
|
|
string IDVyrobok = dtrw.Cells["IDVyrobok"].Value.ToString();
|
|
var cmd = $@"SELECT
|
|
CONCAT(p.RozmerTvar, p.Rozmer1, if(p.RozmerTvar = 'Ø', '/', 'x'), p.Rozmer2, 'x', p.Rozmer3, ' (', p.PocetKusovVPolotovare, '-Ks na polotovar)')
|
|
FROM tabpolotovar p
|
|
WHERE p.IDVyrobok = {IDVyrobok};";
|
|
var VelkostPolotovaru = string.Empty;
|
|
classSQL.SQL(cmd, out VelkostPolotovaru);
|
|
|
|
classGlobal.DeleteRamDisk(); classGlobal.CreateRamDisk();
|
|
classSQL.ExportFormToHDD("Kontrolný list - predná strana.xls", @"W:\tlps.xls");
|
|
|
|
Excel.Application xlApp;
|
|
Excel.Workbook xlWorkBook;
|
|
Excel.Worksheet xlWorkSheet;
|
|
Excel.Range range;
|
|
|
|
xlApp = new Excel.Application();
|
|
xlWorkBook = xlApp.Workbooks.Open(@"W:\tlps.xls");
|
|
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
|
|
|
|
range = xlWorkSheet.UsedRange;
|
|
|
|
xlWorkSheet.Range["D2", "F2"].Value = dtrw.Cells["ZakCislo"].Value.ToString();
|
|
xlWorkSheet.Range["G2", "K2"].Value = "Č.V.: " + dtrw.Cells["NazovVyrobku"].Value.ToString();
|
|
if (dtrw.Cells["UpravaMaterialu"].Value.ToString() == "") xlWorkSheet.Range["H6", "I6"].Value = dtrw.Cells["Material"].Value.ToString();
|
|
else xlWorkSheet.Range["H6", "I6"].Value = dtrw.Cells["Material"].Value.ToString() + "-" + dtrw.Cells["UpravaMaterialu"].Value.ToString();
|
|
DateTime date = (DateTime)dtrw.Cells["DatumPrijatiaOBJ"].Value;
|
|
xlWorkSheet.Range["B4", "C4"].Value = date.Day.ToString() + "." + date.Month.ToString() + "." + date.Year.ToString();
|
|
xlWorkSheet.Range["B6", "C6"].Value = dtrw.Cells["Zakaznik"].Value.ToString();
|
|
xlWorkSheet.Range["D6", "E6"].Value = dtrw.Cells["CisloObj"].Value.ToString();
|
|
xlWorkSheet.Range["F8", "G9"].Value = dtrw.Cells["PocetDoVyroby"].Value.ToString();
|
|
date = (DateTime)dtrw.Cells["DatumPotvrdeny"].Value;
|
|
xlWorkSheet.Range["D10", "F10"].Value = date.Day.ToString() + "." + date.Month.ToString() + "." + date.Year.ToString();
|
|
xlWorkSheet.Range["B8", "E9"].Value = dtrw.Cells["SpojeneRozmery"].Value.ToString();
|
|
if (dtrw.Cells["NazovKontraktu"].Value.ToString() == "") xlWorkSheet.Range["F5", "G5"].Value = "K.č.: --";
|
|
else xlWorkSheet.Range["F5", "G5"].Value = "K.č.: " + dtrw.Cells["NazovKontraktu"].Value.ToString();
|
|
xlWorkSheet.Range["F6", "G6"].Value = "Kon.op.: " + dtrw.Cells["RozlisZnakKonecnaOp"].Value.ToString();
|
|
if (dtrw.Cells["PoznamkaOBJ"].Value.ToString() == "")
|
|
{
|
|
xlWorkSheet.Range["B49", "O54"].Value = $"Poznámky: {Environment.NewLine} Veľkosť polotovaru z výroby: {VelkostPolotovaru}";
|
|
}
|
|
else if (MessageBox.Show("Tlačiť aj poznámku?", "Poznámka??", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
xlWorkSheet.Range["B49", "O54"].Value = $"Poznámky: {dtrw.Cells["PoznamkaOBJ"].Value.ToString()} {Environment.NewLine} {VelkostPolotovaru}";
|
|
}
|
|
|
|
xlApp.Visible = true;
|
|
xlApp.ActiveWindow.Activate();
|
|
xlWorkSheet.PrintPreview();
|
|
|
|
xlApp.Visible = false;
|
|
|
|
xlWorkBook.Save();
|
|
xlWorkBook.Close(false, null, null);
|
|
xlApp.Quit();
|
|
|
|
classGlobal.DeleteRamDisk();
|
|
|
|
string tlacUpdate = "UPDATE `mip`.`tabdopyt` SET `VytlacenyKL-PS` = 1 WHERE IDCPOBJ = " + dtrw.Cells["IDCPOBJ"].Value.ToString() + " ;";
|
|
classSQL.SQL(tlacUpdate);
|
|
|
|
panel48.Visible = false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void btnTlacitZadnuStranu_Click(object sender, EventArgs e)
|
|
{
|
|
DataGridViewRow dtrw2 = dataGridView1.Rows[dataGridView1.CurrentRow.Index];
|
|
if (dtrw2.Cells["TypDopytu"].Value.ToString() == "Objednávka" || dtrw2.Cells["TypDopytu"].Value.ToString() == "Objednávka do kontraktu")
|
|
if (dtrw2.Cells["StatusDopytu"].Value.ToString() != "Odoslaná" && dtrw2.Cells["StatusDopytu"].Value.ToString() != "Pozastavená" && dtrw2.Cells["StatusDopytu"].Value.ToString() != "Zrušená")
|
|
{
|
|
|
|
classGlobal.DeleteRamDisk(); classGlobal.CreateRamDisk();
|
|
classSQL.ExportFormToHDD("Kontrolný list - zadná strana.xls", @"W:\tlzs.xls");
|
|
|
|
Excel.Application xlApp;
|
|
Excel.Workbook xlWorkBook;
|
|
Excel.Worksheet xlWorkSheet;
|
|
Excel.Range range;
|
|
|
|
xlApp = new Excel.Application();
|
|
xlWorkBook = xlApp.Workbooks.Open(@"W:\tlzs.xls");
|
|
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
|
|
range = xlWorkSheet.UsedRange;
|
|
DataGridViewRow dtrw = dataGridView1.Rows[dataGridView1.CurrentRow.Index];
|
|
//printPreviewDialog1.ShowDialog();
|
|
|
|
classSQL.ExportVykresToHDD((int)dtrw.Cells["IDVyrobok"].Value, 1, @"W:\vktl.jpg");
|
|
|
|
Excel.Pictures p = xlWorkSheet.Pictures(System.Type.Missing) as Excel.Pictures;
|
|
Excel.Picture pic = null;
|
|
|
|
pic = p.Insert(@"W:\vktl.jpg", System.Type.Missing);
|
|
|
|
pic.ShapeRange.LockAspectRatio = Microsoft.Office.Core.MsoTriState.msoCTrue;
|
|
|
|
if (pic.ShapeRange.Width / 749.25F > pic.ShapeRange.Height / 648)
|
|
{
|
|
pic.ShapeRange.Width = 749.25F;
|
|
float pictop = (648 - pic.ShapeRange.Height) / 2 + 60;
|
|
pic.Left = 17.25F;
|
|
pic.Top = pictop;
|
|
}
|
|
else
|
|
{
|
|
pic.ShapeRange.Height = 648;
|
|
float picLeft = (749.25F - pic.ShapeRange.Width) / 2 + 17.25F;
|
|
pic.Left = picLeft;
|
|
pic.Top = 60;
|
|
}
|
|
|
|
xlWorkSheet.Range["J2", "L2"].Value = dtrw.Cells["ZakCislo"].Value.ToString();
|
|
if (dtrw.Cells["UpravaMaterialu"].Value.ToString() == "") xlWorkSheet.Range["L3", "M3"].Value = dtrw.Cells["Material"].Value.ToString();
|
|
else xlWorkSheet.Range["L3", "M3"].Value = dtrw.Cells["Material"].Value.ToString() + "-" + dtrw.Cells["UpravaMaterialu"].Value.ToString();
|
|
xlWorkSheet.Range["O2", "Q2"].Value = dtrw.Cells["Zakaznik"].Value.ToString();
|
|
xlWorkSheet.Range["S3", "T3"].Value = dtrw.Cells["CisloObj"].Value.ToString();
|
|
DateTime date = (DateTime)dtrw.Cells["DatumPotvrdeny"].Value;
|
|
xlWorkSheet.Range["P3", "Q3"].Value = date.Day.ToString() + "." + date.Month.ToString() + "." + date.Year.ToString();
|
|
xlWorkSheet.Range["H3", "I3"].Value = dtrw.Cells["SpojeneRozmery"].Value.ToString();
|
|
xlWorkSheet.Range["F3", "G3"].Value = "Č.V.: " + dtrw.Cells["NazovVyrobku"].Value.ToString();
|
|
|
|
xlApp.Visible = true;
|
|
xlApp.ActiveWindow.Activate();
|
|
xlWorkSheet.PrintPreview();
|
|
xlApp.Visible = false;
|
|
|
|
xlWorkBook.Save();
|
|
xlWorkBook.Close(false, null, null);
|
|
xlApp.Quit();
|
|
|
|
classGlobal.DeleteRamDisk();
|
|
|
|
string tlacUpdate = "UPDATE `mip`.`tabdopyt` SET `VytlacenyKL-ZS` = 1 WHERE IDCPOBJ = " + dtrw.Cells["IDCPOBJ"].Value.ToString() + " ;";
|
|
classSQL.SQL(tlacUpdate);
|
|
|
|
panel48.Visible = false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void btnTlacitZoznamy_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
classGlobal.DeleteRamDisk(); classGlobal.CreateRamDisk();
|
|
classSQL.ExportFormToHDD("Týždenný zoznam - expedícia.xls", @"W:\tzexp.xls");
|
|
|
|
Excel.Application xlApp;
|
|
Excel.Workbook xlWorkBook;
|
|
Excel.Worksheet xlWorkSheet;
|
|
Excel.Range range;
|
|
|
|
xlApp = new Excel.Application();
|
|
xlWorkBook = xlApp.Workbooks.Open(@"W:\tzexp.xls");
|
|
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
|
|
range = xlWorkSheet.UsedRange;
|
|
|
|
DataTable tblTlacitZoznamy = new DataTable();
|
|
|
|
string cmdZoznamy = @"SELECT IF (ZakCislo = '0',NazovKontraktu, ZakCislo) AS ZakCislo,
|
|
DatumPotvrdeny,
|
|
Zakaznik,
|
|
CisloObj,
|
|
NazovVyrobku,
|
|
IFNULL((SELECT `DatumOdosNaKontr` FROM `tabvyroba` WHERE `tabvyroba`.IDDopyt=`pohladdopyty`.IDCPOBJ),DATE('1950-01-01')) AS DatumOdosNaKontr,
|
|
IF (UpravaMaterialu = '',Material,CONCAT(Material,'-',UpravaMaterialu)) AS Material,
|
|
UpravaMaterialu,
|
|
Material,
|
|
IF (PocetDoVyroby=0,PocetKusov,CONCAT (PocetKusov,'(',PocetDoVyroby,')')) AS PocetKusov,
|
|
RozlisZnakKonecnaOp,
|
|
SpojeneRozmery,
|
|
IF (StatusDopytu='Pozastavená',StatusDopytu,PoznamkaOBJ) AS PoznamkaOBJ
|
|
FROM pohladdopyty
|
|
WHERE `TypDopytu` != 'Kontrakt' AND
|
|
`TypDopytu` != 'Cenová ponuka' AND
|
|
`TypDopytu` != 'Call Off' AND
|
|
`PocetDoVyroby` != 0 AND
|
|
`StatusDopytu` != 'Zrušená' AND
|
|
`StatusDopytu` != 'Odoslaná'
|
|
ORDER BY `DatumPotvrdeny`, `Zakaznik`, `DatumPrijatiaOBJ`";
|
|
classSQL.SQL(cmdZoznamy, out tblTlacitZoznamy);
|
|
|
|
CultureInfo local = new CultureInfo("sk-SK");
|
|
System.Globalization.Calendar Kal = local.Calendar;
|
|
int week = Kal.GetWeekOfYear(DateTime.Now, local.DateTimeFormat.CalendarWeekRule, local.DateTimeFormat.FirstDayOfWeek);
|
|
xlWorkSheet.Range["B2", "D2"].Value = week.ToString() + ". Kalendárny týždeň";
|
|
|
|
for (int ri = 0; ri < tblTlacitZoznamy.Rows.Count; ri++)
|
|
{
|
|
int excelRowIndex = ri + 4;
|
|
DataRow dtrTlacitZoznamy = tblTlacitZoznamy.Rows[ri];
|
|
|
|
|
|
xlWorkSheet.Range["B" + excelRowIndex.ToString()].Value = ri + 1; //dtrw.Cells["ZakCislo"].Value.ToString();
|
|
DateTime date = (DateTime)dtrTlacitZoznamy["DatumPotvrdeny"];
|
|
xlWorkSheet.Range["C" + excelRowIndex.ToString()].Value = date.Day.ToString() + "." + date.Month.ToString() + "." + date.Year.ToString();
|
|
xlWorkSheet.Range["D" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["Zakaznik"].ToString();
|
|
xlWorkSheet.Range["E" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["CisloObj"].ToString();
|
|
xlWorkSheet.Range["F" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["NazovVyrobku"].ToString();
|
|
xlWorkSheet.Range["G" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["ZakCislo"].ToString();
|
|
if (dtrTlacitZoznamy["DatumOdosNaKontr"].ToString() != "1. 1. 1950 0:00:00")
|
|
{
|
|
DateTime date2 = (DateTime)dtrTlacitZoznamy["DatumOdosNaKontr"];
|
|
xlWorkSheet.Range["H" + excelRowIndex.ToString()].Value = date2.Day.ToString() + "." + date2.Month.ToString() + "." + date2.Year.ToString(); //datum odchodu na lapovnu
|
|
}
|
|
else
|
|
{
|
|
xlWorkSheet.Range["H" + excelRowIndex.ToString()].Value = "";
|
|
}
|
|
xlWorkSheet.Range["I" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["Material"].ToString();
|
|
xlWorkSheet.Range["J" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["PocetKusov"].ToString();
|
|
xlWorkSheet.Range["K" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["RozlisZnakKonecnaOp"].ToString();
|
|
xlWorkSheet.Range["L" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["SpojeneRozmery"].ToString();
|
|
xlWorkSheet.Range["M" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["PoznamkaOBJ"].ToString();
|
|
|
|
}
|
|
//vypocet poslednej strany tlacenia
|
|
double dNumber = Convert.ToDouble(tblTlacitZoznamy.Rows.Count) / Convert.ToDouble(40);
|
|
int lastrow = Convert.ToInt16(Math.Ceiling(dNumber) * 40); //'odpocita cislo prvej bunky kont tab., vydeli poctom riadkov na stramu (40), zaokruhli hore, a vynasobi poctom riadkov na stranu
|
|
xlWorkSheet.PageSetup.PrintArea = "$B$2:$M$" + (lastrow + 3);
|
|
|
|
xlApp.Visible = true;
|
|
xlApp.ActiveWindow.Activate();
|
|
xlWorkSheet.PrintPreview();
|
|
xlApp.Visible = false;
|
|
|
|
xlWorkBook.Save();
|
|
xlWorkBook.Close(false, null, null);
|
|
xlApp.Quit();
|
|
classGlobal.DeleteRamDisk();
|
|
|
|
panel48.Visible = false;
|
|
}
|
|
|
|
//dopyty - tlacit filtrovany zoznam
|
|
private void button111_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
classGlobal.DeleteRamDisk(); classGlobal.CreateRamDisk();
|
|
classSQL.ExportFormToHDD("Týždenný zoznam - expedícia.xls", @"W:\tzexp.xls");
|
|
|
|
Excel.Application xlApp;
|
|
Excel.Workbook xlWorkBook;
|
|
Excel.Worksheet xlWorkSheet;
|
|
Excel.Range range;
|
|
|
|
xlApp = new Excel.Application();
|
|
xlWorkBook = xlApp.Workbooks.Open(@"W:\tzexp.xls");
|
|
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
|
|
range = xlWorkSheet.UsedRange;
|
|
|
|
DataTable tblTlacitZoznamy = new DataTable();
|
|
classSQL.SQL(classUser.strLastSelect, out tblTlacitZoznamy);
|
|
|
|
if (tblTlacitZoznamy.Rows.Count > 520) MessageBox.Show("Počet riadkov prekročil 520, tlač bude zrušená!");
|
|
else
|
|
{
|
|
CultureInfo local = new CultureInfo("sk-SK");
|
|
System.Globalization.Calendar Kal = local.Calendar;
|
|
int week = Kal.GetWeekOfYear(DateTime.Now, local.DateTimeFormat.CalendarWeekRule, local.DateTimeFormat.FirstDayOfWeek);
|
|
xlWorkSheet.Range["B2", "D2"].Value = week.ToString() + ". Kalendárny týždeň";
|
|
|
|
for (int ri = 0; ri < tblTlacitZoznamy.Rows.Count; ri++)
|
|
{
|
|
int excelRowIndex = ri + 4;
|
|
DataRow dtrTlacitZoznamy = tblTlacitZoznamy.Rows[ri];
|
|
|
|
|
|
xlWorkSheet.Range["B" + excelRowIndex.ToString()].Value = ri + 1; //dtrw.Cells["ZakCislo"].Value.ToString();
|
|
DateTime date = (DateTime)dtrTlacitZoznamy["DatumPotvrdeny"];
|
|
xlWorkSheet.Range["C" + excelRowIndex.ToString()].Value = date.Day.ToString() + "." + date.Month.ToString() + "." + date.Year.ToString();
|
|
xlWorkSheet.Range["D" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["Zakaznik"].ToString();
|
|
xlWorkSheet.Range["E" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["CisloObj"].ToString();
|
|
xlWorkSheet.Range["F" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["NazovVyrobku"].ToString();
|
|
xlWorkSheet.Range["G" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["ZakCislo"].ToString();
|
|
if (dtrTlacitZoznamy["DatumOdosNaKontr"].ToString() != "1. 1. 1950 0:00:00")
|
|
{
|
|
DateTime date2 = (DateTime)dtrTlacitZoznamy["DatumOdosNaKontr"];
|
|
xlWorkSheet.Range["H" + excelRowIndex.ToString()].Value = date2.Day.ToString() + "." + date2.Month.ToString() + "." + date2.Year.ToString(); //datum odchodu na lapovnu
|
|
}
|
|
else
|
|
{
|
|
xlWorkSheet.Range["H" + excelRowIndex.ToString()].Value = "";
|
|
}
|
|
xlWorkSheet.Range["I" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["Material"].ToString();
|
|
xlWorkSheet.Range["J" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["PocetKusov"].ToString();
|
|
xlWorkSheet.Range["K" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["RozlisZnakKonecnaOp"].ToString();
|
|
xlWorkSheet.Range["L" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["SpojeneRozmery"].ToString();
|
|
xlWorkSheet.Range["M" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["PoznamkaOBJ"].ToString();
|
|
|
|
}
|
|
//vypocet poslednej strany tlacenia
|
|
double dNumber = Convert.ToDouble(tblTlacitZoznamy.Rows.Count) / Convert.ToDouble(40);
|
|
int lastrow = Convert.ToInt16(Math.Ceiling(dNumber) * 40); //'odpocita cislo prvej bunky kont tab., vydeli poctom riadkov na stramu (40), zaokruhli hore, a vynasobi poctom riadkov na stranu
|
|
xlWorkSheet.PageSetup.PrintArea = "$B$2:$M$" + (lastrow + 3);
|
|
|
|
xlApp.Visible = true;
|
|
xlApp.ActiveWindow.Activate();
|
|
xlWorkSheet.PrintPreview();
|
|
xlApp.Visible = false;
|
|
|
|
xlWorkBook.Save();
|
|
xlWorkBook.Close(false, null, null);
|
|
xlApp.Quit();
|
|
classGlobal.DeleteRamDisk();
|
|
|
|
panel48.Visible = false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void dataGridView1_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
|
|
dataGridView1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
dataGridView1.Columns["TypDopytu"].HeaderText = "Typ dopytu";
|
|
//dataGridView1.Columns["TypDopytu"].Width = 100;
|
|
dataGridView1.Columns["TypDopytu"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;// .DisplayedCellsExceptHeader;
|
|
dataGridView1.Columns["StatusDopytu"].HeaderText = "Status dopytu";
|
|
dataGridView1.Columns["StatusDopytu"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView1.Columns["ZakCislo"].HeaderText = "Zákazkové číslo";
|
|
dataGridView1.Columns["ZakCislo"].Width = 62;
|
|
dataGridView1.Columns["NazovKontraktu"].HeaderText = "Názov kontraktu";
|
|
dataGridView1.Columns["NazovKontraktu"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView1.Columns["CisloOBJ"].HeaderText = "Číslo dopytu";
|
|
dataGridView1.Columns["CisloOBJ"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView1.Columns["Material"].HeaderText = "Materiál";
|
|
dataGridView1.Columns["Material"].Width = 60;
|
|
dataGridView1.Columns["UpravaMaterialu"].HeaderText = "Úprava materiálu";
|
|
dataGridView1.Columns["UpravaMaterialu"].Width = 60;
|
|
dataGridView1.Columns["DatumPrijatiaOBJ"].HeaderText = "Dátum prijatia";
|
|
dataGridView1.Columns["DatumPrijatiaOBJ"].Width = 70;
|
|
dataGridView1.Columns["DatumPotvrdeny"].HeaderText = "Potvrdený dátum";
|
|
dataGridView1.Columns["DatumPotvrdeny"].Width = 70;
|
|
dataGridView1.Columns["Zakaznik"].HeaderText = "Zákazník";
|
|
dataGridView1.Columns["Zakaznik"].MinimumWidth = 56;
|
|
dataGridView1.Columns["Zakaznik"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView1.Columns["IDVyrobok"].Visible = false;
|
|
dataGridView1.Columns["DatumOdosNaKontr"].Visible = false;
|
|
dataGridView1.Columns["IDCPOBJ"].Visible = false;
|
|
dataGridView1.Columns["PocetDoVyroby"].HeaderText = "Počet kusov do výroby";
|
|
dataGridView1.Columns["PocetDoVyroby"].Width = 60;
|
|
dataGridView1.Columns["PocetZoSkladu"].HeaderText = "Počet kusov zo skladu";
|
|
dataGridView1.Columns["PocetZoSkladu"].Width = 60;
|
|
dataGridView1.Columns["CenaOBJ"].HeaderText = "Cena za kus";
|
|
dataGridView1.Columns["CenaOBJ"].Width = 50;
|
|
dataGridView1.Columns["PociatStavKontraktu"].HeaderText = "Počiatočný stav kontraktu";
|
|
dataGridView1.Columns["PociatStavKontraktu"].Visible = false;
|
|
dataGridView1.Columns["PocetKusov"].HeaderText = "Objednaný počet kusov";
|
|
dataGridView1.Columns["PocetKusov"].Width = 60;
|
|
dataGridView1.Columns["PoznamkaOBJ"].HeaderText = "Poznámka";
|
|
dataGridView1.Columns["PoznamkaOBJ"].MinimumWidth = 60;
|
|
dataGridView1.Columns["PoznamkaOBJ"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView1.Columns["NazovVyrobku"].HeaderText = "Názov výrobku";
|
|
dataGridView1.Columns["NazovVyrobku"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView1.Columns["SpojeneRozmery"].HeaderText = "Spojené rozmery";
|
|
dataGridView1.Columns["SpojeneRozmery"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView1.Columns["RozlisZnakKonecnaOp"].HeaderText = "Rozliš. znak, koneč. operácia";
|
|
dataGridView1.Columns["RozlisZnakKonecnaOp"].MinimumWidth = 60;
|
|
dataGridView1.Columns["RozlisZnakKonecnaOp"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView1.Columns["Alias"].HeaderText = "Alias";
|
|
dataGridView1.Columns["Alias"].MinimumWidth = 60;
|
|
dataGridView1.Columns["Alias"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView1.Columns["InyNazov"].HeaderText = "Iný názov";
|
|
dataGridView1.Columns["InyNazov"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView1.Columns["VytlacenyKL-PS"].Visible = false;
|
|
dataGridView1.Columns["VytlacenyKL-ZS"].Visible = false;
|
|
|
|
|
|
if (btnZobrazenie.Text == "Zobrazenie (min)")
|
|
{
|
|
dataGridView1.Columns["PocetDoVyroby"].Visible = true;
|
|
dataGridView1.Columns["CenaOBJ"].Visible = true;
|
|
dataGridView1.Columns["SpojeneRozmery"].Visible = true;
|
|
dataGridView1.Columns["UpravaMaterialu"].Visible = true;
|
|
dataGridView1.Columns["RozlisZnakKonecnaOp"].Visible = true;
|
|
dataGridView1.Columns["InyNazov"].Visible = true;
|
|
dataGridView1.Columns["Alias"].Visible = true;
|
|
|
|
}
|
|
else
|
|
{
|
|
dataGridView1.Columns["PocetDoVyroby"].Visible = false;
|
|
dataGridView1.Columns["CenaOBJ"].Visible = false;
|
|
dataGridView1.Columns["SpojeneRozmery"].Visible = false;
|
|
dataGridView1.Columns["UpravaMaterialu"].Visible = false;
|
|
dataGridView1.Columns["RozlisZnakKonecnaOp"].Visible = false;
|
|
dataGridView1.Columns["InyNazov"].Visible = false;
|
|
dataGridView1.Columns["Alias"].Visible = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void tabPage1_Enter(object sender, EventArgs e)
|
|
{
|
|
//dataGridView1.MouseWheel += new MouseEventHandler(dataGridView1_MouseWheel);
|
|
check();
|
|
}
|
|
// nefunguje to tu
|
|
/*
|
|
private void dataGridView1_MouseWheel(object sender, MouseEventArgs e)
|
|
{
|
|
if (e.Delta > 0 && numericUpDown1.Value < numericUpDown1.Maximum) numericUpDown1.Value++;
|
|
if (e.Delta < 0 && numericUpDown1.Value > numericUpDown1.Minimum) numericUpDown1.Value--;
|
|
}
|
|
*/
|
|
private void dataGridView4_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
if (dataGridView4.Rows.Count != 0)
|
|
{
|
|
dataGridView4.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView4.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
dataGridView4.Columns["TypDopytu"].HeaderText = "Typ dopytu";
|
|
dataGridView4.Columns["StatusDopytu"].HeaderText = "Status dopytu";
|
|
dataGridView4.Columns["ZakCislo"].HeaderText = "Zákazkové číslo";
|
|
dataGridView4.Columns["ZakCislo"].Visible = false;
|
|
dataGridView4.Columns["NazovKontraktu"].Visible = false;
|
|
dataGridView4.Columns["CisloOBJ"].HeaderText = "Číslo Kontraktu";
|
|
dataGridView4.Columns["Material"].HeaderText = "Materiál";
|
|
dataGridView4.Columns["UpravaMaterialu"].HeaderText = "Úprava materiálu";
|
|
dataGridView4.Columns["DatumPrijatiaOBJ"].HeaderText = "Dátum prijatia kontraktu";
|
|
dataGridView4.Columns["DatumPrijatiaOBJ"].Visible = false;
|
|
//dataGridView4.Columns["DatumPrijatiaOBJ"].Visible = false;
|
|
dataGridView4.Columns["DatumPotvrdeny"].HeaderText = "Potvrdený dátum";
|
|
dataGridView4.Columns["Zakaznik"].HeaderText = "Zákazník";
|
|
dataGridView4.Columns["IDVyrobok"].Visible = false;
|
|
dataGridView4.Columns["IDCPOBJ"].Visible = false;
|
|
dataGridView4.Columns["PocetDoVyroby"].HeaderText = "Počet kusov do výroby";
|
|
dataGridView4.Columns["PocetDoVyroby"].Visible = false;
|
|
dataGridView4.Columns["PocetZoSkladu"].HeaderText = "Počet kusov zo skladu";
|
|
dataGridView4.Columns["PocetZoSkladu"].Visible = false;
|
|
dataGridView4.Columns["PociatStavKontraktu"].HeaderText = "Počiatočný stav kontraktu";
|
|
dataGridView4.Columns["PocetKusov"].HeaderText = "Počet kusov";
|
|
dataGridView4.Columns["PoznamkaOBJ"].HeaderText = "Poznámka";
|
|
dataGridView4.Columns["NazovVyrobku"].HeaderText = "Názov výrobku";
|
|
dataGridView4.Columns["SpojeneRozmery"].HeaderText = "Spojené rozmery";
|
|
dataGridView4.Columns["SpojeneRozmery"].Visible = false;
|
|
dataGridView4.Columns["RozlisZnakKonecnaOp"].HeaderText = "Rozliš. znak, koneč. operácia";
|
|
dataGridView4.Columns["RozlisZnakKonecnaOp"].Visible = false;
|
|
dataGridView4.Columns["Alias"].HeaderText = "Alias";
|
|
dataGridView4.Columns["Alias"].Visible = false;
|
|
dataGridView4.Columns["InyNazov"].HeaderText = "Iný názov";
|
|
dataGridView4.Columns["VytlacenyKL-PS"].Visible = false;
|
|
dataGridView4.Columns["VytlacenyKL-ZS"].Visible = false;
|
|
|
|
dataGridView4.AutoResizeColumns();
|
|
}
|
|
|
|
}
|
|
|
|
private void dataGridView5_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
if (dataGridView5.Rows.Count != 0)
|
|
{
|
|
dataGridView5.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView5.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
dataGridView5.Columns["TypDopytu"].HeaderText = "Typ dopytu";
|
|
dataGridView5.Columns["StatusDopytu"].HeaderText = "Status dopytu";
|
|
dataGridView5.Columns["ZakCislo"].HeaderText = "Zákazkové číslo";
|
|
dataGridView5.Columns["ZakCislo"].Visible = false;
|
|
dataGridView5.Columns["NazovKontraktu"].Visible = false;
|
|
dataGridView5.Columns["CisloOBJ"].HeaderText = "Číslo Kontraktu";
|
|
dataGridView5.Columns["Material"].HeaderText = "Materiál";
|
|
dataGridView5.Columns["UpravaMaterialu"].HeaderText = "Úprava materiálu";
|
|
dataGridView5.Columns["DatumPrijatiaOBJ"].HeaderText = "Dátum prijatia kontraktu";
|
|
//dataGridView5.Columns["DatumPrijatiaOBJ"].Visible = false;
|
|
dataGridView5.Columns["DatumPotvrdeny"].HeaderText = "Potvrdený dátum";
|
|
dataGridView5.Columns["Zakaznik"].HeaderText = "Zákazník";
|
|
dataGridView5.Columns["IDVyrobok"].Visible = false;
|
|
dataGridView5.Columns["IDCPOBJ"].Visible = false;
|
|
dataGridView5.Columns["PocetDoVyroby"].HeaderText = "Počet kusov do výroby";
|
|
dataGridView5.Columns["PocetDoVyroby"].Visible = false;
|
|
dataGridView5.Columns["PocetZoSkladu"].HeaderText = "Počet kusov zo skladu";
|
|
dataGridView5.Columns["PocetZoSkladu"].Visible = false;
|
|
dataGridView5.Columns["PociatStavKontraktu"].HeaderText = "Počiatočný stav kontraktu";
|
|
dataGridView5.Columns["PocetKusov"].HeaderText = "Počet kusov";
|
|
dataGridView5.Columns["PoznamkaOBJ"].HeaderText = "Poznámka";
|
|
dataGridView5.Columns["NazovVyrobku"].HeaderText = "Názov výrobku";
|
|
dataGridView5.Columns["SpojeneRozmery"].HeaderText = "Spojené rozmery";
|
|
dataGridView5.Columns["RozlisZnakKonecnaOp"].HeaderText = "Rozliš. znak, koneč. operácia";
|
|
dataGridView5.Columns["Alias"].HeaderText = "Alias";
|
|
dataGridView5.Columns["InyNazov"].HeaderText = "Iný názov";
|
|
dataGridView5.Columns["VytlacenyKL-PS"].Visible = false;
|
|
dataGridView5.Columns["VytlacenyKL-ZS"].Visible = false;
|
|
|
|
dataGridView5.AutoResizeColumns();
|
|
}
|
|
}
|
|
|
|
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
if (e.KeyCode == Keys.Down && dataGridView1.SelectedRows[0].Index == classSQL.intPocetNaStranu - 1 && numericUpDown1.Value < PocetStran)
|
|
{
|
|
numericUpDown1.Value++;
|
|
dataGridView1.CurrentCell = dataGridView1.FirstDisplayedCell;
|
|
boolUp = true;
|
|
}
|
|
if (e.KeyCode == Keys.Up && dataGridView1.SelectedRows[0].Index == 0 && numericUpDown1.Value > 1)
|
|
{
|
|
numericUpDown1.Value--;
|
|
dataGridView1.CurrentCell = dataGridView1[1, classSQL.intPocetNaStranu - 1];
|
|
boolDown = true;
|
|
}
|
|
if (e.KeyCode == Keys.PageDown && numericUpDown1.Value < PocetStran) numericUpDown1.Value++;
|
|
if (e.KeyCode == Keys.PageUp && numericUpDown1.Value > 1) numericUpDown1.Value--;
|
|
}
|
|
|
|
private void dataGridView1_SelectionChanged(object sender, EventArgs e)
|
|
{
|
|
if (boolUp == true)
|
|
{
|
|
SendKeys.Send("{UP}");
|
|
boolUp = false;
|
|
}
|
|
if (boolDown == true)
|
|
{
|
|
SendKeys.Send("{DOWN}");
|
|
boolDown = false;
|
|
}
|
|
}
|
|
|
|
private void checkBox47_CheckedChanged(object sender, EventArgs e) { check(); }
|
|
private void checkBox46_CheckedChanged(object sender, EventArgs e) { check(); }
|
|
private void checkBox45_CheckedChanged(object sender, EventArgs e) { check(); }
|
|
private void checkBox44_CheckedChanged(object sender, EventArgs e) { check(); }
|
|
private void checkBox43_CheckedChanged(object sender, EventArgs e) { check(); }
|
|
private void checkBox42_CheckedChanged(object sender, EventArgs e) { check(); }
|
|
private void checkBox41_CheckedChanged(object sender, EventArgs e) { check(); }
|
|
private void checkBox40_CheckedChanged(object sender, EventArgs e) { check(); }
|
|
private void checkBox50_CheckedChanged(object sender, EventArgs e) { check(); }
|
|
private void checkBox49_CheckedChanged(object sender, EventArgs e) { check(); }
|
|
private void checkBox48_CheckedChanged(object sender, EventArgs e) { check(); }
|
|
private void checkBox51_CheckedChanged(object sender, EventArgs e) { check(); }
|
|
private void radioButton9_CheckedChanged(object sender, EventArgs e) { check(); }
|
|
private void radioButton8_CheckedChanged(object sender, EventArgs e) { check(); }
|
|
private void textBox4_TextChanged(object sender, EventArgs e) { check(); }
|
|
|
|
private void textBox4_EnabledChanged(object sender, EventArgs e)
|
|
{
|
|
if (textBox4.Enabled == true) textBox4.BackColor = Color.BlanchedAlmond;
|
|
else textBox4.BackColor = Color.LightGray;
|
|
}
|
|
|
|
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
check();
|
|
}
|
|
|
|
private void textBox5_TextChanged(object sender, EventArgs e)
|
|
{
|
|
check();
|
|
}
|
|
|
|
private void panel8_Click(object sender, EventArgs e)
|
|
{
|
|
textBox4.Text = "";
|
|
textBox4.Enabled = false;
|
|
checkBox1.Checked = true;
|
|
checkBox2.Checked = true;
|
|
checkBox3.Checked = true;
|
|
checkBox16.Checked = true;
|
|
checkBox15.Checked = true;
|
|
checkBox40.Checked = true;
|
|
checkBox41.Checked = true;
|
|
checkBox42.Checked = true;
|
|
checkBox43.Checked = true;
|
|
checkBox44.Checked = true;
|
|
checkBox45.Checked = true;
|
|
checkBox46.Checked = true;
|
|
checkBox47.Checked = true;
|
|
checkBox48.Checked = true;
|
|
checkBox49.Checked = true;
|
|
checkBox50.Checked = true;
|
|
checkBox51.Checked = true;
|
|
radioButton8.Checked = true;
|
|
|
|
}
|
|
|
|
private void button56_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel7.Visible == false) panel7.Visible = true;
|
|
else panel7.Visible = false;
|
|
|
|
}
|
|
|
|
private void btnTlacitDokumentaciu_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
DataGridViewRow dtrw2 = dataGridView1.Rows[dataGridView1.CurrentRow.Index];
|
|
if (dtrw2.Cells["TypDopytu"].Value.ToString() == "Objednávka" || dtrw2.Cells["TypDopytu"].Value.ToString() == "Objednávka do kontraktu")
|
|
if (dtrw2.Cells["StatusDopytu"].Value.ToString() != "Odoslaná" && dtrw2.Cells["StatusDopytu"].Value.ToString() != "Pozastavená" && dtrw2.Cells["StatusDopytu"].Value.ToString() != "Zrušená")
|
|
{
|
|
|
|
classGlobal.DeleteRamDisk(); classGlobal.CreateRamDisk();
|
|
classSQL.ExportFormToHDD("Výkresová dokumentácia.xls", @"W:\vd.xls");
|
|
|
|
Excel.Application xlApp;
|
|
Excel.Workbook xlWorkBook;
|
|
Excel.Worksheet xlWorkSheet;
|
|
Excel.Range range;
|
|
|
|
xlApp = new Excel.Application();
|
|
xlWorkBook = xlApp.Workbooks.Open(@"W:\vd.xls");
|
|
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
|
|
range = xlWorkSheet.UsedRange;
|
|
|
|
DataGridViewRow dtrw = dataGridView1.Rows[dataGridView1.CurrentRow.Index];
|
|
|
|
string strVyk = "";
|
|
strVyk = "SELECT * FROM `pohladvykresy` WHERE `IDVyrobok` = " + Convert.ToInt32(dtrw.Cells["IDVyrobok"].Value).ToString() + ";";
|
|
DataTable tblVyk = new DataTable();
|
|
classSQL.SQL(strVyk, out tblVyk);
|
|
|
|
for (i = 1; i <= tblVyk.Rows.Count; i++)
|
|
{
|
|
|
|
classSQL.ExportVykresToHDD(
|
|
(int)tblVyk.Rows[i - 1].ItemArray[tblVyk.Columns["IDVyrobok"].Ordinal],
|
|
(int)tblVyk.Rows[i - 1].ItemArray[tblVyk.Columns["IndexVykresu"].Ordinal],
|
|
@"W:\vd" + tblVyk.Rows[i - 1].ItemArray[tblVyk.Columns["IndexVykresu"].Ordinal].ToString() + ".jpg");
|
|
|
|
Excel.Pictures p = xlWorkSheet.Pictures(System.Type.Missing) as Excel.Pictures;
|
|
Excel.Picture pic = null;
|
|
pic = p.Insert(@"W:\vd" + tblVyk.Rows[i - 1].ItemArray[tblVyk.Columns["IndexVykresu"].Ordinal].ToString() + ".jpg", System.Type.Missing);
|
|
pic.ShapeRange.LockAspectRatio = Microsoft.Office.Core.MsoTriState.msoCTrue;
|
|
if (pic.ShapeRange.Width / 951.75F > pic.ShapeRange.Height / 696.75F)
|
|
{
|
|
pic.ShapeRange.Width = 951.75F;
|
|
float pictop = (696.75F - pic.ShapeRange.Height) / 2 + 60;
|
|
pic.Left = 16.5F;
|
|
pic.Top = pictop;
|
|
}
|
|
else
|
|
{
|
|
pic.ShapeRange.Height = 696.75F;
|
|
float picLeft = (951.75F - pic.ShapeRange.Width) / 2 + 16.5F;
|
|
pic.Left = picLeft;
|
|
pic.Top = 35.25F;
|
|
}
|
|
|
|
xlWorkSheet.Range["I2", "M2"].Value = tblVyk.Rows[i - 1].ItemArray[tblVyk.Columns["NazovVyrobku"].Ordinal].ToString() + " - " + tblVyk.Rows[i - 1].ItemArray[tblVyk.Columns["IndexVykresu"].Ordinal].ToString();
|
|
xlWorkSheet.Range["P2", "T2"].Value = tblVyk.Rows[i - 1].ItemArray[tblVyk.Columns["Zakaznik"].Ordinal].ToString();
|
|
|
|
|
|
xlApp.Visible = true;
|
|
xlApp.ActiveWindow.Activate();
|
|
xlWorkSheet.PrintPreview();
|
|
xlApp.Visible = false;
|
|
|
|
}
|
|
|
|
xlWorkBook.Save();
|
|
xlWorkBook.Close(false, null, null);
|
|
xlApp.Quit();
|
|
classGlobal.DeleteRamDisk();
|
|
|
|
panel48.Visible = false;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
private void btnTlacitZoznamZoSkladu_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
classGlobal.DeleteRamDisk(); classGlobal.CreateRamDisk();
|
|
classSQL.ExportFormToHDD("Týždenný zoznam - požiadavky zo skladu.xls", @"W:\tzpzs.xls");
|
|
|
|
Excel.Application xlApp;
|
|
Excel.Workbook xlWorkBook;
|
|
Excel.Worksheet xlWorkSheet;
|
|
Excel.Range range;
|
|
|
|
xlApp = new Excel.Application();
|
|
xlWorkBook = xlApp.Workbooks.Open(@"W:\tzpzs.xls");
|
|
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
|
|
range = xlWorkSheet.UsedRange;
|
|
|
|
DataTable tblTlacitZoznamy = new DataTable();
|
|
|
|
string cmdTlacPZS = @"SELECT `TypDopytu`,
|
|
`StatusDopytu`,
|
|
IF(ZakCislo = 0,`NazovKontraktu`,ZakCislo) AS `ZakCislo`,
|
|
(SELECT DISTINCT `StatusSkladOperacie` FROM `tabskladvyrobkov` WHERE `tabskladvyrobkov`.IDDopyt = `pohladdopyty`.IDCPOBJ) AS `StavSkladOperacie`,
|
|
`CisloObj`,
|
|
`Material`,
|
|
`UpravaMaterialu`,
|
|
`DatumPrijatiaOBJ`,
|
|
`DatumPotvrdeny`,
|
|
`Zakaznik`,
|
|
`IDVyrobok`,
|
|
`IDCPOBJ`,
|
|
`CenaOBJ`,
|
|
`PocetDoVyroby`,
|
|
`PocetZoSkladu`,
|
|
`PociatStavKontraktu`,
|
|
`PocetKusov`,
|
|
`PoznamkaOBJ`,
|
|
`NazovVyrobku`,
|
|
`SpojeneRozmery`,
|
|
`RozlisZnakKonecnaOp`,
|
|
`Alias`,
|
|
`InyNazov`
|
|
FROM pohladdopyty WHERE `TypDopytu` != 'Kontrakt' AND
|
|
`TypDopytu` != 'Cenová ponuka' AND
|
|
`StatusDopytu` != 'Zrušená' AND
|
|
`StatusDopytu` != 'Pozastavená' AND
|
|
`StatusDopytu` != 'Odoslaná' AND
|
|
`StatusDopytu` != 'Odoslaný' AND
|
|
`PocetZoSkladu` != 0
|
|
ORDER BY `DatumPotvrdeny`, `Zakaznik`, `DatumPrijatiaOBJ`";
|
|
classSQL.SQL(cmdTlacPZS, out tblTlacitZoznamy);
|
|
|
|
CultureInfo local = new CultureInfo("sk-SK");
|
|
System.Globalization.Calendar Kal = local.Calendar;
|
|
int week = Kal.GetWeekOfYear(DateTime.Now, local.DateTimeFormat.CalendarWeekRule, local.DateTimeFormat.FirstDayOfWeek);
|
|
xlWorkSheet.Range["B2", "D2"].Value = week.ToString() + ". Kalendárny týždeň";
|
|
|
|
for (int ri = 0; ri < tblTlacitZoznamy.Rows.Count; ri++)
|
|
{
|
|
int excelRowIndex = ri + 4;
|
|
DataRow dtrTlacitZoznamy = tblTlacitZoznamy.Rows[ri];
|
|
|
|
|
|
xlWorkSheet.Range["B" + excelRowIndex.ToString()].Value = ri + 1; //dtrw.Cells["ZakCislo"].Value.ToString();
|
|
DateTime date = (DateTime)dtrTlacitZoznamy["DatumPotvrdeny"];
|
|
xlWorkSheet.Range["C" + excelRowIndex.ToString()].Value = date.Day.ToString() + "." + date.Month.ToString() + "." + date.Year.ToString();
|
|
xlWorkSheet.Range["D" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["Zakaznik"].ToString();
|
|
xlWorkSheet.Range["E" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["CisloObj"].ToString();
|
|
xlWorkSheet.Range["F" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["ZakCislo"].ToString();
|
|
xlWorkSheet.Range["G" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["NazovVyrobku"].ToString();
|
|
xlWorkSheet.Range["H" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["StavSkladOperacie"].ToString(); //datum odchodu na lapovnu
|
|
if (dtrTlacitZoznamy["UpravaMaterialu"].ToString() == "") xlWorkSheet.Range["I" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["Material"].ToString();
|
|
else xlWorkSheet.Range["I" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["Material"].ToString() + "-" + dtrTlacitZoznamy["UpravaMaterialu"].ToString();
|
|
xlWorkSheet.Range["J" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["PocetZoSkladu"].ToString();
|
|
xlWorkSheet.Range["K" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["RozlisZnakKonecnaOp"].ToString();
|
|
xlWorkSheet.Range["L" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["SpojeneRozmery"].ToString();
|
|
xlWorkSheet.Range["M" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["PoznamkaOBJ"].ToString();
|
|
|
|
}
|
|
//vypocet poslednej strany tlacenia
|
|
double dNumber = Convert.ToDouble(tblTlacitZoznamy.Rows.Count) / Convert.ToDouble(40);
|
|
int lastrow = Convert.ToInt16(Math.Ceiling(dNumber) * 40); //'odpocita cislo prvej bunky kont tab., vydeli poctom riadkov na stramu (40), zaokruhli hore, a vynasobi poctom riadkov na stranu
|
|
xlWorkSheet.PageSetup.PrintArea = "$B$2:$M$" + (lastrow + 3);
|
|
|
|
xlApp.Visible = true;
|
|
xlApp.ActiveWindow.Activate();
|
|
xlWorkSheet.PrintPreview();
|
|
xlApp.Visible = false;
|
|
|
|
xlWorkBook.Save();
|
|
xlWorkBook.Close(false, null, null);
|
|
xlApp.Quit();
|
|
classGlobal.DeleteRamDisk();
|
|
|
|
panel48.Visible = false;
|
|
}
|
|
|
|
private void checkBox16_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
check();
|
|
}
|
|
|
|
private void checkBox15_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
check();
|
|
}
|
|
|
|
private void btnZobrazenie_Click(object sender, EventArgs e)
|
|
{
|
|
if (btnZobrazenie.Text == "Zobrazenie (min)") btnZobrazenie.Text = "Zobrazenie (max)";
|
|
else btnZobrazenie.Text = "Zobrazenie (min)";
|
|
dataGridView1_Paint(null, null);
|
|
}
|
|
|
|
//Int32 intRI = 0;
|
|
private void button63_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
DataGridViewRow dtgvr = dataGridView1.Rows[classUser.IndexDopyt];
|
|
|
|
if (dtgvr.Cells["StatusDopytu"].Value.ToString() != "Odoslaná"
|
|
&& dtgvr.Cells["StatusDopytu"].Value.ToString() != "Odoslaný"
|
|
&& dtgvr.Cells["StatusDopytu"].Value.ToString() != "Na lapovni"
|
|
&& dtgvr.Cells["StatusDopytu"].Value.ToString() != "Čiastočne odoslaná"
|
|
&& dtgvr.Cells["StatusDopytu"].Value.ToString() != "Skončený"
|
|
&& dtgvr.Cells["StatusDopytu"].Value.ToString() != "Pozastavená"
|
|
&& dtgvr.Cells["StatusDopytu"].Value.ToString() != "Pozastavený"
|
|
&& dtgvr.Cells["StatusDopytu"].Value.ToString() != "Zrušená"
|
|
&& dtgvr.Cells["StatusDopytu"].Value.ToString() != "Zrušený"
|
|
&& dtgvr.Cells["TypDopytu"].Value.ToString() != "Cenová ponuka")
|
|
{
|
|
string strStatus = "";
|
|
if (dtgvr.Cells["TypDopytu"].Value.ToString() == "Kontrakt" || dtgvr.Cells["TypDopytu"].Value.ToString() == "Call Off") strStatus = "Pozastavený";
|
|
else strStatus = "Pozastavená";
|
|
|
|
string cmdStatusUpdate = "UPDATE `mip`.`tabdopyt` SET `StatusDopytu` = '" + strStatus + "' WHERE `IDCPOBJ`= " + dtgvr.Cells["IDCPOBJ"].Value.ToString() + ";";
|
|
classSQL.SQL(cmdStatusUpdate);
|
|
}
|
|
if (dtgvr.Cells["StatusDopytu"].Value.ToString() == "Pozastavená")
|
|
{
|
|
string cmdStatusUpdate = "UPDATE `mip`.`tabdopyt` SET `StatusDopytu` = 'Zrušená' WHERE `IDCPOBJ`= " + dtgvr.Cells["IDCPOBJ"].Value.ToString() + ";";
|
|
classSQL.SQL(cmdStatusUpdate);
|
|
}
|
|
if (dtgvr.Cells["StatusDopytu"].Value.ToString() == "Pozastavený")
|
|
{
|
|
string cmdStatusUpdate = "UPDATE `mip`.`tabdopyt` SET `StatusDopytu` = 'Zrušený' WHERE `IDCPOBJ`= " + dtgvr.Cells["IDCPOBJ"].Value.ToString() + ";";
|
|
classSQL.SQL(cmdStatusUpdate);
|
|
}
|
|
if (dtgvr.Cells["StatusDopytu"].Value.ToString() == "Zrušená")
|
|
{
|
|
string cmdStatusUpdate = "UPDATE `mip`.`tabdopyt` SET `StatusDopytu` = 'Prijatá' WHERE `IDCPOBJ`= " + dtgvr.Cells["IDCPOBJ"].Value.ToString() + ";";
|
|
classSQL.SQL(cmdStatusUpdate);
|
|
}
|
|
if (dtgvr.Cells["StatusDopytu"].Value.ToString() == "Zrušený")
|
|
{
|
|
string cmdStatusUpdate = "UPDATE `mip`.`tabdopyt` SET `StatusDopytu` = 'Prijatý' WHERE `IDCPOBJ`= " + dtgvr.Cells["IDCPOBJ"].Value.ToString() + ";";
|
|
classSQL.SQL(cmdStatusUpdate);
|
|
}
|
|
check();
|
|
dataGridView1.Rows[classUser.IndexDopyt].Selected = true;
|
|
|
|
}
|
|
|
|
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
classUser.IndexDopyt = e.RowIndex;
|
|
// dataGridView1.ClearSelection();
|
|
// dataGridView1.Rows[classUser.IndexDopyt].Selected = true;
|
|
|
|
}
|
|
|
|
private void btnEditOBJ_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView1.CurrentRow.Cells["StatusDopytu"].Value.ToString() != "Odoslaná" &&
|
|
dataGridView1.CurrentRow.Cells["StatusDopytu"].Value.ToString() != "Pozastavená" &&
|
|
dataGridView1.CurrentRow.Cells["StatusDopytu"].Value.ToString() != "Zrušená")
|
|
{
|
|
Form frmEditDopyt2 = new frmEditDopyt(dataGridView1.SelectedRows[0].Cells["IDCPOBJ"].Value.ToString());
|
|
frmEditDopyt2.ShowDialog();
|
|
check();
|
|
}
|
|
else MessageBox.Show("Dopyt nie je možné editovať!");
|
|
}
|
|
|
|
#endregion cp a objednavky
|
|
|
|
#region nastavenia
|
|
|
|
private void tabPage11_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void tabPage11_Enter(object sender, EventArgs e)
|
|
{
|
|
tpNastavenia_Refresh();
|
|
}
|
|
|
|
|
|
private void btnObnovit_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
DataTable tblUsers = new DataTable();
|
|
classSQL.SQL("SELECT * from tabusers where `IDUsers` > 2 ORDER BY priezvisko", out tblUsers);
|
|
//classSQL.dTable = tblUsers;
|
|
dataGridView2.DataSource = tblUsers;
|
|
|
|
dataGridView2.Columns["IDUsers"].Visible = false;
|
|
dataGridView2.ClearSelection();
|
|
if (rowIndex > 0) dataGridView2.Rows[rowIndex].Selected = true;
|
|
//odblokuj = true;
|
|
}
|
|
|
|
//private void dataGridView2_CellValueChanged(object sender, DataGridViewCellEventArgs e)
|
|
//{
|
|
|
|
// string c;
|
|
// if (odblokuj)
|
|
// {
|
|
|
|
// c = "UPDATE `mip`.`tabusers` SET `"
|
|
// + dataGridView2.Columns[e.ColumnIndex].Name.ToString()
|
|
// + "` = "
|
|
// + dataGridView2.CurrentCell.Value.ToString()
|
|
// + " WHERE `IDUsers`="
|
|
// + dataGridView2.Rows[e.RowIndex].Cells["IDUsers"].Value.ToString()
|
|
// + ";";
|
|
|
|
// classSQL.SQL(c);
|
|
|
|
// }
|
|
//}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
Application.Exit();
|
|
}
|
|
|
|
private void btnPridatUzivatela_Click(object sender, EventArgs e)
|
|
{
|
|
string cmd = "";
|
|
Int32 lastUserInsert;
|
|
cmd = @"INSERT INTO `mip`.`tabusers` (`Meno`, `Priezvisko`, `OnlineStatus`, `PristupovePrava`, `Status`, `Zaradenie`) VALUES ('NoveMeno', '', 'Offline', 0, 'Neaktívny', 'Administratíva');";
|
|
classSQL.SQL(cmd, out lastUserInsert);
|
|
|
|
btnObnovit_Click(null, null);
|
|
dataGridView2.ClearSelection();
|
|
dataGridView2.Rows[0].Selected = true;
|
|
|
|
textBox46.Text = dataGridView2.SelectedRows[0].Cells["Meno"].Value.ToString();
|
|
textBox47.Text = dataGridView2.SelectedRows[0].Cells["Priezvisko"].Value.ToString();
|
|
textBox48.Text = dataGridView2.SelectedRows[0].Cells["Titul"].Value.ToString();
|
|
textBox49.Text = dataGridView2.SelectedRows[0].Cells["Heslo"].Value.ToString();
|
|
label221.Text = dataGridView2.SelectedRows[0].Cells["OnlineStatus"].Value.ToString();
|
|
label222.Text = dataGridView2.SelectedRows[0].Cells["Status"].Value.ToString();
|
|
label223.Text = dataGridView2.SelectedRows[0].Cells["Zaradenie"].Value.ToString();
|
|
label225.Text = dataGridView2.SelectedRows[0].Cells["PristupovePrava"].Value.ToString();
|
|
if (dataGridView2.SelectedRows[0].Cells["Status"].Value.ToString() == "Aktívny") panel73.BackColor = Color.MintCream;
|
|
if (dataGridView2.SelectedRows[0].Cells["Status"].Value.ToString() == "Neaktívny") panel73.BackColor = Color.MistyRose;
|
|
converToBoolArray(label225.Text);
|
|
rowIndex = dataGridView2.SelectedRows[0].Index;
|
|
}
|
|
|
|
private void btnExportFrm_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
|
{
|
|
DataRow drw = globNastaveniadtbl.Rows[dataGridView9.CurrentRow.Index];
|
|
classSQL.ExportFormToHDD(drw["NazovSuboru"].ToString(), saveFileDialog1.FileName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DataTable globNastaveniadtbl = new DataTable();
|
|
private void tpNastavenia_Refresh()
|
|
{
|
|
|
|
classSQL.SQL("SELECT `NazovSuboru`,`PoznamkaFormulara`,`IDFormulara` FROM `tabformular`", out globNastaveniadtbl);
|
|
dataGridView9.DataSource = globNastaveniadtbl;
|
|
|
|
ToolTip toolTip1 = new ToolTip();
|
|
|
|
toolTip1.AutoPopDelay = 7000;
|
|
toolTip1.InitialDelay = 150;
|
|
toolTip1.ReshowDelay = 100;
|
|
toolTip1.ShowAlways = true;
|
|
|
|
toolTip1.SetToolTip(this.checkBox74, "Dopyty");
|
|
toolTip1.SetToolTip(this.checkBox75, "Zoznam výrobkov");
|
|
toolTip1.SetToolTip(this.checkBox76, "Výdaj materiálu");
|
|
toolTip1.SetToolTip(this.checkBox79, "Riadenie výroby");
|
|
toolTip1.SetToolTip(this.checkBox78, "Skladové operácie");
|
|
toolTip1.SetToolTip(this.checkBox77, "Expedícia");
|
|
toolTip1.SetToolTip(this.checkBox82, "Kategorizácia zmätkovitosti");
|
|
toolTip1.SetToolTip(this.checkBox81, "Zmätkovitosť");
|
|
toolTip1.SetToolTip(this.checkBox80, "Nastavenia");
|
|
toolTip1.SetToolTip(this.checkBox85, "Zoznam Strojov");
|
|
toolTip1.SetToolTip(this.checkBox84, "Údržby a opravy");
|
|
toolTip1.SetToolTip(this.checkBox83, "Naceňovanie");
|
|
toolTip1.SetToolTip(this.checkBox88, "Vyhodnocovanie");
|
|
toolTip1.SetToolTip(this.checkBox87, "Zoznam firiem");
|
|
toolTip1.SetToolTip(this.checkBox86, "Nástroje");
|
|
toolTip1.SetToolTip(this.checkBox94, "Výkresy");
|
|
toolTip1.SetToolTip(this.checkBox93, "Sklad");
|
|
toolTip1.SetToolTip(this.checkBox92, "Požiadavky/Pripomienky");
|
|
toolTip1.SetToolTip(this.checkBox91, "Žiadankový systém");
|
|
toolTip1.SetToolTip(this.checkBox90, "Evidencia brúsených nástrojov");
|
|
toolTip1.SetToolTip(this.checkBox89, "Zatiaľ nepridelené");
|
|
}
|
|
|
|
|
|
|
|
private void btnPridatFrm_Click(object sender, EventArgs e)
|
|
{
|
|
int FileSize;
|
|
byte[] FileData;
|
|
FileStream fs;
|
|
|
|
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
|
{
|
|
fs = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read);
|
|
FileSize = (int)fs.Length;
|
|
|
|
FileData = new byte[FileSize];
|
|
fs.Read(FileData, 0, FileSize);
|
|
fs.Close();
|
|
char[] d = new char[fs.Name.Length - fs.Name.LastIndexOf("\\") - 1];
|
|
fs.Name.CopyTo(fs.Name.LastIndexOf("\\") + 1, d, 0, fs.Name.Length - fs.Name.LastIndexOf("\\") - 1);
|
|
|
|
string s = new string(d);
|
|
classSQL.SaveFormToSQL(s, FileData);
|
|
tpNastavenia_Refresh();
|
|
|
|
}
|
|
}
|
|
|
|
private void btnZmazatFrm_Click(object sender, EventArgs e)
|
|
{
|
|
DataRow dtrw;
|
|
|
|
dtrw = globNastaveniadtbl.Rows[dataGridView9.CurrentRow.Index];
|
|
classSQL.SQL("DELETE FROM `tabformular` WHERE `IDFormulara`=" + dtrw["IDFormulara"].ToString() + ";");
|
|
tpNastavenia_Refresh();
|
|
}
|
|
|
|
private void button52_Click(object sender, EventArgs e)
|
|
{
|
|
WebClient webClient = new WebClient();
|
|
string IP = webClient.DownloadString("http://ifconfig.me/ip");
|
|
MessageBox.Show(IP);
|
|
}
|
|
|
|
private void button53_Click(object sender, EventArgs e)
|
|
{
|
|
string cmd = "select SUBSTRING_INDEX(host,':',1) as 'ip' from information_schema.processlist WHERE ID=connection_id();";
|
|
string strIP;
|
|
classSQL.SQL(cmd, out strIP);
|
|
MessageBox.Show(strIP);
|
|
}
|
|
|
|
private void button54_Click(object sender, EventArgs e)
|
|
{
|
|
string cmd = "SELECT SUBSTRING(USER(), LOCATE('@', USER())+1) as ip;";
|
|
string strIP;
|
|
classSQL.SQL(cmd, out strIP);
|
|
MessageBox.Show(strIP);
|
|
|
|
}
|
|
|
|
private void button55_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
MessageBox.Show(LocalIPAddress().ToString());
|
|
|
|
}
|
|
|
|
private IPAddress LocalIPAddress()
|
|
{
|
|
if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
|
|
{
|
|
return null;
|
|
}
|
|
|
|
IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName());
|
|
|
|
return host
|
|
.AddressList
|
|
.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork);
|
|
}
|
|
|
|
|
|
#endregion nastavenia
|
|
|
|
#region hlavne okno
|
|
|
|
|
|
private void frmMain_FormClosed(object sender, FormClosedEventArgs e)
|
|
{
|
|
classGlobal.DeleteRamDisk();
|
|
classDiskOperations.RemoveCurrentUserProtecion(classDiskOperations.TempPath);
|
|
classDiskOperations.RemovePath(classDiskOperations.TempPath);
|
|
|
|
classSQL.SQL("UPDATE `mip`.`tabusers` SET `OnlineStatus`='Offline' WHERE `IDUsers`=" + classUser.ID + ";");
|
|
//classSQL.commandSQL("UPDATE `mip`.`tabusers` SET `OnlineStatus`='Offline' WHERE `IDUsers`=" + classUser.ID + ";");
|
|
eventWatcher.Stop();
|
|
}
|
|
|
|
private void frmMain_Load(object sender, EventArgs e)
|
|
{
|
|
int intWidth = (int)(Screen.PrimaryScreen.WorkingArea.Width - 10);
|
|
int intHeight = (int)(Screen.PrimaryScreen.WorkingArea.Height - 10);
|
|
this.Width = intWidth;
|
|
this.Height = intHeight;
|
|
this.Location = new Point(5, 5);
|
|
|
|
classGlobal.SetServerIP();
|
|
classUser.LimitSqlPrikazu = Convert.ToInt32(numericUpDown40.Value);
|
|
|
|
if (classUser.MariaDBServerIPAddress != "0.0.0.0")
|
|
{
|
|
Form frmLogo2 = new frmLogo();
|
|
frmLogo2.ShowDialog();
|
|
|
|
Form frmLogin2 = new frmLogin();
|
|
frmLogin2.ShowDialog();
|
|
|
|
|
|
refreshZistiNovuSpravu.Enabled = true;
|
|
refreshZistiNovuSpravu.Interval = 10000;
|
|
refreshZistiNovuSpravu.Tick += new System.EventHandler(ZistiNovuSpravu);
|
|
|
|
WqlEventQuery query = new WqlEventQuery("Win32_PowerManagementEvent"); //catch power change events
|
|
eventWatcher.Query = query;
|
|
eventWatcher.EventArrived += new System.Management.EventArrivedEventHandler(eventWatcher_EventArrived); // register the event handler
|
|
eventWatcher.Start(); // start the event watcher
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Aplikácia MIP bude kliknutím OK ukončená!");
|
|
}
|
|
|
|
}
|
|
Timer refreshZistiNovuSpravu = new Timer();
|
|
private void ZistiNovuSpravu(object sender, EventArgs e)
|
|
{
|
|
if (refreshZistiNovuSpravu.Interval == 20000)
|
|
{
|
|
panel4.Visible = false;
|
|
|
|
string cmd = "SELECT COUNT(*) FROM `Mip`.`tabchat` WHERE `Status`= 'Neprečítaná' AND `Komu`= " + classUser.ID + ";";
|
|
string strNoveSpravy = "0";
|
|
classSQL.SQL(cmd, out strNoveSpravy);
|
|
if (strNoveSpravy == "") strNoveSpravy = "0";
|
|
if (Convert.ToInt32(strNoveSpravy) != 0) refreshZistiNovuSpravu.Interval = 500;
|
|
|
|
ZistiUpdate();
|
|
|
|
|
|
}
|
|
if (refreshZistiNovuSpravu.Interval == 500)
|
|
{
|
|
panel4.Visible = !panel4.Visible;
|
|
|
|
}
|
|
}
|
|
|
|
//event priradi premennej hodnotu true ak pocitac prejde do rezimu spanku, zapne sa vo frmMainLoad
|
|
ManagementEventWatcher eventWatcher = new System.Management.ManagementEventWatcher();
|
|
void eventWatcher_EventArrived(object sender, System.Management.EventArrivedEventArgs e)
|
|
{
|
|
int eventType = Convert.ToInt32(e.NewEvent.Properties["EventType"].Value);
|
|
switch (eventType)
|
|
{
|
|
case 4://sleep
|
|
classUser.boolComputerAsleep = true;
|
|
break;
|
|
case 7://resume
|
|
classUser.boolComputerAsleep = false;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
private void frmMain_Shown(object sender, EventArgs e)
|
|
{
|
|
//znizenie poctu nacitavanych riadkov
|
|
// if (classUser.ID == 1 || classUser.ID == 2) numericUpDown40.Value = 100;
|
|
|
|
/////////////////////////// zobrazenie povolenych zaloziek usera v tabcontroll ////////////////////////////////////////////
|
|
int p1, p2, p3; // p1 pocitadlo cyklu, p2 - pocet zaloziek, p3 - ukazovatel na aktualnu zalozku
|
|
Int32 intMaska;
|
|
for (p1 = 0, p2 = tabControl1.TabCount, intMaska = 1, p3 = 0;
|
|
p1 < p2;
|
|
p1++, intMaska *= 2)
|
|
{
|
|
Int32 vysledok;
|
|
|
|
vysledok = classUser.Tab & intMaska;
|
|
if (vysledok == 0) tabControl1.TabPages.Remove(tabControl1.TabPages[p3]);
|
|
else p3++;
|
|
|
|
}
|
|
tabControl1.Visible = true;
|
|
///////////////////////////////////////////////////////////////
|
|
classGlobal.DeleteRamDisk();
|
|
//MessageBox.Show(classUser.ID.ToString());
|
|
//classSQL.commandSQL("UPDATE `mip`.`tabusers` SET `OnlineStatus`='Online' WHERE `IDUsers`=" + classUser.ID + ";");
|
|
classSQL.SQL("UPDATE `mip`.`tabusers` SET `OnlineStatus`='Online' WHERE `IDUsers`=" + classUser.ID + ";");
|
|
this.toolStripStatusLabel1.Text = "Prihásený užívateľ: " + classUser.Titul + " " + classUser.Meno + " " + classUser.Priezvisko;
|
|
tabControl1.TabPages[0].Select();
|
|
toolStripStatusLabel2.Text = "IP adresa servera MariaDB: " + classUser.MariaDBServerIPAddress;
|
|
toolStripStatusLabel5.Text = classUser.Zaradenie + ":";
|
|
if (classUser.Zaradenie == "Administratíva") toolStripStatusLabel6.Visible = false;
|
|
|
|
|
|
ZistiUpdate();
|
|
|
|
}
|
|
|
|
private void ZistiUpdate()
|
|
{
|
|
string cmd = "SELECT `PoznamkaFormulara` FROM `tabformular` WHERE `NazovSuboru` = 'MIP-install.exe';";
|
|
string strVerzia;
|
|
|
|
classSQL.SQL(cmd, out strVerzia);
|
|
if (strVerzia == "") strVerzia = "0";
|
|
|
|
//DataTable strNovaVerzia = classSQL.commandSQL(cmd, 1);
|
|
|
|
if (Convert.ToDouble(strVerzia) > 0)
|
|
{
|
|
if (Convert.ToDouble(strVerzia) > Convert.ToDouble(lblVerzia.Text)) btnUpdate.Enabled = true;
|
|
else btnUpdate.Enabled = false;
|
|
}
|
|
|
|
}
|
|
|
|
private void frmMain_Resize(object sender, EventArgs e)
|
|
{
|
|
classUser.mainWindowState = this.WindowState;
|
|
switch (tabControl1.SelectedTab.Text)
|
|
{
|
|
case "Kategorizácia zmätkovitosti":
|
|
refreshZmatkovitost();
|
|
break;
|
|
case "Dopyty":
|
|
hScrollbar = dataGridView4.Controls.OfType<HScrollBar>().First();
|
|
if (hScrollbar.Visible == true && hScrollbar != null)
|
|
{
|
|
splitContainer4.Panel1MinSize = 88;
|
|
splitContainer4.SplitterDistance = 88;
|
|
}
|
|
else
|
|
{
|
|
splitContainer4.SplitterDistance = 71;
|
|
splitContainer4.Panel1MinSize = 71;
|
|
}
|
|
break;
|
|
case "Zoznam firiem":
|
|
if (panel28.Size.Height != 25) panel28.Size = new Size(panel28.Size.Width, flowLayoutPanel1.Size.Height - 112);
|
|
if (panel29.Size.Height != 25) panel29.Size = new Size(panel29.Size.Width, flowLayoutPanel1.Size.Height - 112);
|
|
if (panel31.Size.Height != 25) panel31.Size = new Size(panel31.Size.Width, flowLayoutPanel1.Size.Height - 112);
|
|
if (panel32.Size.Height != 25) panel32.Size = new Size(panel32.Size.Width, flowLayoutPanel1.Size.Height - 112);
|
|
if (panel33.Size.Height != 25) panel33.Size = new Size(panel33.Size.Width, flowLayoutPanel1.Size.Height - 112);
|
|
break;
|
|
case "Riadenie výroby":
|
|
refreshRV();
|
|
break;
|
|
case "Výkresy":
|
|
refreshVykres();
|
|
break;
|
|
case "Sklad":
|
|
refreshSklad();
|
|
break;
|
|
/*
|
|
default:
|
|
MessageBox.Show ("resize hlavneho okna - case pre tento tabpage nie je nastaveny");
|
|
break;
|
|
*/
|
|
}
|
|
}
|
|
|
|
ScrollBar hScrollbar;
|
|
private void frmMain_ResizeBegin(object sender, EventArgs e)
|
|
{
|
|
hScrollbar = dataGridView4.Controls.OfType<HScrollBar>().First();
|
|
|
|
}
|
|
|
|
private void frmMain_ResizeEnd(object sender, EventArgs e)
|
|
{
|
|
hScrollbar = null;
|
|
}
|
|
|
|
|
|
|
|
#endregion hlavne okno
|
|
|
|
#region Vydaj materialu
|
|
|
|
private void tabPage3_Enter(object sender, EventArgs e)
|
|
{
|
|
dGVVydajMat.MouseWheel += new MouseEventHandler(dGVVydajMat_MouseWheel);
|
|
refreshVydajMat();
|
|
|
|
}
|
|
|
|
private void dGVVydajMat_MouseWheel(object sender, MouseEventArgs e)
|
|
{
|
|
if (e.Delta > 0 && numericUpDown14.Value < numericUpDown14.Maximum) numericUpDown14.Value++;
|
|
if (e.Delta < 0 && numericUpDown14.Value > numericUpDown14.Minimum) numericUpDown14.Value--;
|
|
}
|
|
|
|
private void refreshVydajMat()
|
|
{
|
|
|
|
int scrollBarHeight = 0;
|
|
if (dGVVydajMat.Controls.OfType<HScrollBar>().First().Visible == true) scrollBarHeight = dGVVydajMat.Controls.OfType<HScrollBar>().First().Height;
|
|
int headerHeight = dGVVydajMat.ColumnHeadersHeight;
|
|
if (headerHeight < 25) headerHeight = 47;
|
|
|
|
classSQL.intPocetNaStranu = Convert.ToInt32(Math.Floor((double)((dGVVydajMat.Height - headerHeight - scrollBarHeight - 2) / 22)));
|
|
|
|
if (dGVVydajMat.SelectedRows.Count > 0) classUser.IndexVydajMat = Convert.ToInt32(dGVVydajMat[dGVVydajMat.Columns["IDCPOBJ"].Index, dGVVydajMat.SelectedRows[0].Index].Value.ToString());
|
|
else classUser.IndexVydajMat = 0;
|
|
|
|
string strTextBoxCondition = ""; string strCheckBoxCondition = " AND(`StatusDopytu` = 'Prázdna hodnota'";
|
|
|
|
foreach (CheckBox chb in groupBox21.Controls)
|
|
{
|
|
if (chb.Checked) strCheckBoxCondition = strCheckBoxCondition + " OR `StatusDopytu` = '" + chb.Text + "'";
|
|
}
|
|
strCheckBoxCondition = strCheckBoxCondition + ")";
|
|
|
|
string strZoradenie = "";
|
|
if (radioButton7.Checked == true) strZoradenie = " ORDER BY `DatumPotvrdeny` DESC, `Zakaznik` ASC, `DatumPrijatiaOBJ` DESC";
|
|
if (radioButton6.Checked == true) strZoradenie = " ORDER BY `ZakCislo` DESC";
|
|
|
|
if (VydajMatColorIndex > 0) strTextBoxCondition = " AND INSTR(`" + dGVVydajMat.Columns[VydajMatColorIndex].Name + "`, '" + textBox17.Text + "')>0 ";
|
|
|
|
string sqlCommandVydajMat = "SELECT * FROM `mip`.`pohladvyroba` WHERE (TypDopytu = 'Objednávka' OR TypDopytu = 'Objednávka do kontraktu')" + strCheckBoxCondition + strTextBoxCondition + strZoradenie + ";";
|
|
|
|
DataTable dtbVydajMat = new DataTable();
|
|
Int32 StartRecord = (Convert.ToInt32(numericUpDown14.Value) * classSQL.intPocetNaStranu) - classSQL.intPocetNaStranu;
|
|
|
|
classSQL.SQL(sqlCommandVydajMat, StartRecord, classSQL.intPocetNaStranu, out dtbVydajMat);
|
|
dGVVydajMat.DataSource = dtbVydajMat;
|
|
|
|
Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
label22.Text = numericUpDown14.Value.ToString() + "/" + PocetStran.ToString();
|
|
if (PocetStran < 1) PocetStran = 1;
|
|
numericUpDown14.Maximum = PocetStran;
|
|
|
|
dataGVSetColumnSortMode(dGVVydajMat, DataGridViewColumnSortMode.NotSortable);
|
|
setDGV(dGVVydajMat, classUser.IndexVydajMat, textBox17);
|
|
|
|
}
|
|
|
|
private void rBVydMatNezadane_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
//this.Controls.Remove(controlToDeleteVydMat);
|
|
//if (rBVydMatNezadane.Checked == true) refreshVydajMat("SELECT * FROM `mip`.`pohladvyroba` WHERE (TypDopytu = 'Objednávka' OR TypDopytu = 'Objednávka do kontraktu') AND StatusDopytu = 'Zaradená do výroby';");
|
|
refreshVydajMat();
|
|
}
|
|
|
|
private void rBVydMatVsetky_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
//this.Controls.Remove(controlToDeleteVydMat);
|
|
//if (rBVydMatVsetky.Checked == true) refreshVydajMat("SELECT * FROM `mip`.`pohladvyroba` WHERE TypDopytu = 'Objednávka' OR TypDopytu = 'Objednávka do kontraktu';");
|
|
refreshVydajMat();
|
|
}
|
|
|
|
private void dGVVydajMat_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
|
{
|
|
//classGlobal.SetRowColor(dGVVydajMat, e.ColumnIndex, e.RowIndex, e.Value.ToString());
|
|
}
|
|
|
|
void SaveClosePanel(object sender, EventArgs e)
|
|
{
|
|
Int32 intIDVyroba = 0;
|
|
Int32 intIDDopyt = 0;
|
|
string strStatus = "";
|
|
intIDVyroba = Convert.ToInt32(dGVVydajMat.Rows[eRowIndex].Cells["IDVyroba"].Value);
|
|
intIDDopyt = Convert.ToInt32(dGVVydajMat.Rows[eRowIndex].Cells["IDDopyt"].Value);
|
|
strStatus = dGVVydajMat.Rows[eRowIndex].Cells["StatusDopytu"].Value.ToString();
|
|
|
|
string cmd = "UPDATE `mip`.`tabvyroba` SET `PocetVydkusov`=" + lpocet.ToString() + ", `DatumVydMat` = DATE(NOW()) WHERE `IDVyroba`=" + intIDVyroba.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
cmd = "UPDATE `mip`.`tabdopyt` SET `StatusDopytu`= 'Vo výrobe' WHERE `IDCPOBJ`=" + intIDDopyt.ToString() + ";";
|
|
if (strStatus == "Zaradená do výroby") classSQL.SQL(cmd);
|
|
|
|
//if (rBVydMatNezadane.Checked == true) refreshVydajMat("SELECT * FROM `mip`.`pohladvyroba` WHERE (TypDopytu = 'Objednávka' OR TypDopytu = 'Objednávka do kontraktu') AND StatusDopytu = 'Zaradená do výroby';");
|
|
//if (rBVydMatVsetky.Checked == true) refreshVydajMat("SELECT * FROM `mip`.`pohladvyroba` WHERE TypDopytu = 'Objednávka' OR TypDopytu = 'Objednávka do kontraktu';");
|
|
refreshVydajMat();
|
|
|
|
|
|
lButton.Click -= new EventHandler(SaveClosePanel);
|
|
this.Controls.Remove(pPocetKusov);
|
|
bool_ZobrazVstupExp = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Control controlToDeleteVydMat;
|
|
Int32 eRowIndex;
|
|
Int32 lpocet;
|
|
private void dGVVydajMat_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
classUser.IndexVydajMat = e.RowIndex;
|
|
|
|
if (e.RowIndex != -1)
|
|
{
|
|
if (dGVVydajMat.Columns[e.ColumnIndex].Name == "PocetVydKusov" && dGVVydajMat.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Zaradená do výroby" && bool_ZobrazVstupPreVydMat == false) //zároveN ak je premenná bool_ZobrazVstup.. = false čo znamená, že panel nie je ešte otvorený
|
|
{
|
|
eRowIndex = e.RowIndex;
|
|
bool_ZobrazVstupPreVydMat = true;
|
|
ZobrazVstupPreVydMat(e.RowIndex);
|
|
}
|
|
}
|
|
|
|
}
|
|
private void dGVVydajMat_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (e.RowIndex != -1)
|
|
{
|
|
if (dGVVydajMat.Columns[e.ColumnIndex].Name == "PocetVydKusov" && dGVVydajMat.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Vo výrobe" && bool_ZobrazVstupPreVydMat == false) //zároveN ak je premenná bool_ZobrazVstup.. = false čo znamená, že panel nie je ešte otvorený
|
|
{
|
|
eRowIndex = e.RowIndex;
|
|
bool_ZobrazVstupPreVydMat = true;
|
|
ZobrazVstupPreVydMat(e.RowIndex);
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
private void dGVVydajMat_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
|
{
|
|
if (e.RowIndex != -1)
|
|
{
|
|
// if (dGVVydajMat.Columns[e.ColumnIndex].Name == "PocetVydKusov" && dGVVydajMat.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Vo výrobe" && bool_ZobrazVstupPreVydMat == false) //zároveN ak je premenná bool_ZobrazVstup.. = false čo znamená, že panel nie je ešte otvorený
|
|
// {
|
|
eRowIndex = e.RowIndex;
|
|
bool_ZobrazVstupPreVydMat = true;
|
|
ZobrazVstupPreVydMat(e.RowIndex);
|
|
|
|
// }
|
|
}
|
|
}
|
|
}
|
|
|
|
bool bool_ZobrazVstupPreVydMat = false;
|
|
Button lButton;
|
|
Panel pPocetKusov;
|
|
|
|
private void ZobrazVstupPreVydMat(Int32 eRI)
|
|
{
|
|
Label lPocetKusov = new Label();
|
|
lPocetKusov.AutoSize = true;
|
|
lPocetKusov.Text = "Počet pre: " + dGVVydajMat.Rows[eRI].Cells["ZakCislo"].Value.ToString();
|
|
lPocetKusov.TextAlign = ContentAlignment.MiddleCenter;
|
|
lPocetKusov.Location = new Point(0, 0);
|
|
|
|
TextBox lTextBox = new TextBox();
|
|
lTextBox.Size = new Size(lPocetKusov.Size.Width + 47, 20);
|
|
lTextBox.Location = new Point(1, lPocetKusov.Size.Height - 7);
|
|
if (dGVVydajMat.Rows[eRI].Cells["PocetVydKusov"].Value.ToString() == "") lTextBox.Text = dGVVydajMat.Rows[eRI].Cells["PocetDoVyroby"].Value.ToString();
|
|
else lTextBox.Text = dGVVydajMat.Rows[eRI].Cells["PocetVydKusov"].Value.ToString();
|
|
lTextBox.TextChanged += new EventHandler(ltext);
|
|
lTextBox.KeyPress += new KeyPressEventHandler(ltextkeypress);
|
|
|
|
lButton = new Button();
|
|
lButton.Size = new Size(100, 38);
|
|
lButton.Location = new Point(lPocetKusov.Size.Width + 48, 0);
|
|
lButton.Text = "Uložiť počet";
|
|
|
|
pPocetKusov = new Panel();
|
|
pPocetKusov.Size = new Size(250, 40);
|
|
pPocetKusov.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
pPocetKusov.Name = "pPocetKusov";
|
|
|
|
int x = 0; int y = 0;
|
|
if (MousePosition.X + pPocetKusov.Width + 50 > this.Width) x = MousePosition.X - pPocetKusov.Width;
|
|
else x = MousePosition.X;
|
|
if (MousePosition.Y + pPocetKusov.Height + 70 > this.Height) y = MousePosition.Y - pPocetKusov.Height;
|
|
else y = MousePosition.Y;
|
|
pPocetKusov.Location = new Point(x - 10, y - 25);
|
|
|
|
pPocetKusov.Controls.Add(lPocetKusov);
|
|
pPocetKusov.Controls.Add(lTextBox);
|
|
pPocetKusov.Controls.Add(lButton);
|
|
this.Controls.Add(pPocetKusov);
|
|
lTextBox.Focus();
|
|
|
|
|
|
lButton.Click += new EventHandler(SaveClosePanel);
|
|
pPocetKusov.Leave += new EventHandler(pPocetKusov_Leave);
|
|
|
|
pPocetKusov.BringToFront();
|
|
}
|
|
|
|
|
|
private void pPocetKusov_Leave(object sender, EventArgs e)
|
|
{
|
|
lButton.Click -= new EventHandler(SaveClosePanel);
|
|
pPocetKusov.Leave -= new EventHandler(pPocetKusov_Leave);
|
|
bool_ZobrazVstupPreVydMat = false;
|
|
this.Controls.Remove(pPocetKusov);
|
|
|
|
|
|
}
|
|
|
|
|
|
int xClickPos = 0;
|
|
int yClickPos = 0;
|
|
private void dGVVydajMat_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
//this.Controls.Remove(controlToDeleteVydMat);
|
|
xClickPos = e.X;
|
|
yClickPos = e.Y;
|
|
|
|
}
|
|
|
|
void ltextkeypress(object sender, KeyPressEventArgs e)
|
|
{
|
|
//TextBox tb = sender as TextBox;
|
|
|
|
int intResult;
|
|
if (!(int.TryParse(textBox1.Text + e.KeyChar, out intResult)) && (int)e.KeyChar != 8) e.KeyChar = '\0';
|
|
|
|
|
|
}
|
|
|
|
void ltext(object sender, EventArgs e)
|
|
{
|
|
TextBox tb = sender as TextBox;
|
|
|
|
if (tb.Text != "") lpocet = Convert.ToInt32(tb.Text);
|
|
else lpocet = 0;
|
|
|
|
}
|
|
|
|
private void dGVVydajMat_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
dGVVydajMat.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dGVVydajMat.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
dGVVydajMat.Columns["TypDopytu"].HeaderText = "Typ dopytu";
|
|
dGVVydajMat.Columns["TypDopytu"].Visible = false;
|
|
dGVVydajMat.Columns["StatusDopytu"].HeaderText = "Status dopytu";
|
|
dGVVydajMat.Columns["ZakCislo"].HeaderText = "Zákazkové číslo";
|
|
dGVVydajMat.Columns["NazovKontraktu"].Visible = false;
|
|
dGVVydajMat.Columns["CisloOBJ"].HeaderText = "Číslo dopytu";
|
|
dGVVydajMat.Columns["CisloOBJ"].Visible = false;
|
|
dGVVydajMat.Columns["Material"].HeaderText = "Materiál";
|
|
dGVVydajMat.Columns["UpravaMaterialu"].HeaderText = "Úprava materiálu";
|
|
dGVVydajMat.Columns["DatumPrijatiaOBJ"].Visible = false;
|
|
//dGVVydajMat.Columns["DatumPotvrdeny"].Visible = false;
|
|
dGVVydajMat.Columns["Zakaznik"].HeaderText = "Zákazník";
|
|
dGVVydajMat.Columns["IDVyrobok"].Visible = false;
|
|
dGVVydajMat.Columns["PoznamkaOBJ"].HeaderText = "Poznámka";
|
|
//dGVVydajMat.Columns["PoznamkaOBJ"].Visible = false;
|
|
dGVVydajMat.Columns["PocetDoVyroby"].HeaderText = "Počet kusov do výroby";
|
|
dGVVydajMat.Columns["CenaOBJ"].Visible = false;
|
|
dGVVydajMat.Columns["IDUsers"].Visible = false;
|
|
dGVVydajMat.Columns["IDCPOBJ"].Visible = false;
|
|
dGVVydajMat.Columns["DatumPrijatiaDoVyr"].HeaderText = "Dátum prijatia do výroby";
|
|
dGVVydajMat.Columns["DatumPrijatiaDoVyr"].Visible = false;
|
|
dGVVydajMat.Columns["DatumVydMat"].HeaderText = "Dátum vydania materiálu";
|
|
//dGVVydajMat.Columns["DatumVydMat"].Visible = false;
|
|
dGVVydajMat.Columns["PocetVydKusov"].HeaderText = "Počet vydaných kusov";
|
|
dGVVydajMat.Columns["DatumOdosNaKontr"].Visible = false;
|
|
dGVVydajMat.Columns["IDDopyt"].Visible = false;
|
|
dGVVydajMat.Columns["IDVyroba"].Visible = false;
|
|
dGVVydajMat.Columns["NazovVyrobku"].Visible = false;
|
|
//dGVVydajMat.Columns["SpojeneRozmery"].Visible = false;
|
|
|
|
if (button94.Text == "Zobrazenie (min)")
|
|
{
|
|
dGVVydajMat.Columns["SpojeneRozmery"].Visible = true;
|
|
dGVVydajMat.Columns["PoznamkaOBJ"].Visible = true;
|
|
dGVVydajMat.Columns["DatumVydMat"].Visible = true;
|
|
dGVVydajMat.Columns["DatumPotvrdeny"].Visible = true;
|
|
|
|
}
|
|
else
|
|
{
|
|
dGVVydajMat.Columns["SpojeneRozmery"].Visible = false;
|
|
dGVVydajMat.Columns["PoznamkaOBJ"].Visible = false;
|
|
dGVVydajMat.Columns["DatumVydMat"].Visible = false;
|
|
dGVVydajMat.Columns["DatumPotvrdeny"].Visible = false;
|
|
|
|
}
|
|
|
|
dGVVydajMat.AutoResizeColumns();
|
|
}
|
|
|
|
private void tabPage3_Leave(object sender, EventArgs e)
|
|
{
|
|
//this.Controls.Remove(controlToDeleteVydMat);
|
|
}
|
|
|
|
|
|
private void button62_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel19.Visible == false) panel19.Visible = true;
|
|
else panel19.Visible = false;
|
|
}
|
|
|
|
|
|
private void numericUpDown14_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
refreshVydajMat();
|
|
}
|
|
|
|
|
|
private void panel20_Click(object sender, EventArgs e)
|
|
{
|
|
textBox17.Text = "";
|
|
checkBox39.Checked = false;
|
|
checkBox38.Checked = false;
|
|
checkBox37.Checked = false;
|
|
checkBox29.Checked = true;
|
|
checkBox28.Checked = false;
|
|
checkBox27.Checked = false;
|
|
checkBox26.Checked = false;
|
|
checkBox25.Checked = false;
|
|
|
|
}
|
|
|
|
private void textBox16_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshVydajMat();
|
|
}
|
|
|
|
private void textBox17_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshVydajMat();
|
|
}
|
|
|
|
int VydajMatColorIndex = -1;
|
|
private void dGVVydajMat_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
if (VydajMatColorIndex != e.ColumnIndex && VydajMatColorIndex != -1) dGVVydajMat.Columns[VydajMatColorIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
|
|
if (dGVVydajMat.Columns[e.ColumnIndex].DefaultCellStyle.BackColor == Color.Empty)
|
|
{
|
|
dGVVydajMat.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.GreenYellow;
|
|
VydajMatColorIndex = e.ColumnIndex;
|
|
textBox17.Text = "";
|
|
textBox17.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
dGVVydajMat.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
VydajMatColorIndex = -1;
|
|
textBox17.Text = "";
|
|
textBox17.Enabled = false;
|
|
}
|
|
}
|
|
|
|
private void checkBox29_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshVydajMat();
|
|
}
|
|
|
|
private void radioButton7_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshVydajMat();
|
|
}
|
|
|
|
private void radioButton6_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshVydajMat();
|
|
}
|
|
|
|
private void checkBox39_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshVydajMat();
|
|
}
|
|
|
|
private void checkBox38_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshVydajMat();
|
|
}
|
|
|
|
private void checkBox37_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshVydajMat();
|
|
}
|
|
|
|
private void checkBox28_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshVydajMat();
|
|
}
|
|
|
|
private void checkBox27_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshVydajMat();
|
|
}
|
|
|
|
private void checkBox26_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshVydajMat();
|
|
}
|
|
|
|
private void checkBox25_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshVydajMat();
|
|
}
|
|
|
|
private void dGVVydajMat_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
if (e.KeyCode == Keys.Down && dGVVydajMat.SelectedRows[0].Index == classSQL.intPocetNaStranu - 1 && numericUpDown14.Value < PocetStran)
|
|
{
|
|
numericUpDown14.Value++;
|
|
dGVVydajMat.CurrentCell = dGVVydajMat.FirstDisplayedCell;
|
|
boolUp = true;
|
|
}
|
|
if (e.KeyCode == Keys.Up && dGVVydajMat.SelectedRows[0].Index == 0 && numericUpDown14.Value > 1)
|
|
{
|
|
numericUpDown14.Value--;
|
|
dGVVydajMat.CurrentCell = dGVVydajMat[1, classSQL.intPocetNaStranu - 1];
|
|
boolDown = true;
|
|
}
|
|
if (e.KeyCode == Keys.PageDown && numericUpDown14.Value < PocetStran) numericUpDown14.Value++;
|
|
if (e.KeyCode == Keys.PageUp && numericUpDown14.Value > 1) numericUpDown14.Value--;
|
|
}
|
|
|
|
private void dGVVydajMat_SelectionChanged(object sender, EventArgs e)
|
|
{
|
|
if (boolUp == true)
|
|
{
|
|
SendKeys.Send("{UP}");
|
|
boolUp = false;
|
|
}
|
|
if (boolDown == true)
|
|
{
|
|
SendKeys.Send("{DOWN}");
|
|
boolDown = false;
|
|
}
|
|
}
|
|
|
|
private void button94_Click(object sender, EventArgs e)
|
|
{
|
|
if (button94.Text == "Zobrazenie (min)") button94.Text = "Zobrazenie (max)";
|
|
else button94.Text = "Zobrazenie (min)";
|
|
dGVVydajMat_Paint(null, null);
|
|
}
|
|
|
|
private void button85_Click(object sender, EventArgs e)
|
|
{
|
|
string strZak = dGVVydajMat.Rows[dGVVydajMat.SelectedRows[0].Index].Cells["Zakaznik"].Value.ToString();
|
|
string strIDVyr = dGVVydajMat.Rows[dGVVydajMat.SelectedRows[0].Index].Cells["IDVyrobok"].Value.ToString();
|
|
|
|
Form zobrazVykres = new frmShowVykres(strZak, Convert.ToInt32(strIDVyr));
|
|
zobrazVykres.Show();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion Vydaj materialu
|
|
|
|
#region Riadenie vyroby
|
|
|
|
|
|
private void dGVRV_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
|
{
|
|
//classGlobal.SetRowColor(dGVRV, e.ColumnIndex, e.RowIndex, e.Value.ToString());
|
|
}
|
|
|
|
private void refreshRV()
|
|
{
|
|
|
|
int scrollBarHeight = 0;
|
|
if (dGVRV.Controls.OfType<HScrollBar>().First().Visible == true) scrollBarHeight = dGVRV.Controls.OfType<HScrollBar>().First().Height;
|
|
int headerHeight = dGVRV.ColumnHeadersHeight;
|
|
if (headerHeight < 25) headerHeight = 47;
|
|
|
|
classSQL.intPocetNaStranu = Convert.ToInt32(Math.Floor((double)((dGVRV.Height - headerHeight - scrollBarHeight - 2) / 22)));
|
|
if (classSQL.intPocetNaStranu > 1)
|
|
{
|
|
if (dGVRV.SelectedRows.Count > 0) classUser.IndexRV = Convert.ToInt32(dGVRV[dGVRV.Columns["IDCPOBJ"].Index, dGVRV.SelectedRows[0].Index].Value.ToString());
|
|
else classUser.IndexRV = 0;
|
|
|
|
|
|
string strTextBoxCondition = ""; string strCheckBoxCondition = " AND(`StatusDopytu` = 'Prázdna hodnota'";
|
|
|
|
foreach (CheckBox chb in groupBox18.Controls)
|
|
{
|
|
if (chb.Checked) strCheckBoxCondition = strCheckBoxCondition + " OR `StatusDopytu` = '" + chb.Text + "'";
|
|
}
|
|
strCheckBoxCondition = strCheckBoxCondition + ")";
|
|
|
|
string strZoradenie = "";
|
|
if (radioButton4.Checked == true) strZoradenie = " ORDER BY `DatumPotvrdeny` DESC, `Zakaznik` ASC, `DatumPrijatiaOBJ` DESC";
|
|
if (radioButton5.Checked == true) strZoradenie = " ORDER BY `ZakCislo` DESC";
|
|
|
|
if (RVColorIndex > 0) strTextBoxCondition = " AND INSTR(`" + dGVRV.Columns[RVColorIndex].Name + "`, '" + textBox15.Text + "')>0 ";
|
|
|
|
string sqlCommandRV = "SELECT * FROM `mip`.`pohladvyroba` WHERE (`TypDopytu` = 'Objednávka' OR `TypDopytu` = 'Objednávka do kontraktu') " + strCheckBoxCondition + strTextBoxCondition + strZoradenie + ";";
|
|
|
|
DataTable dtbRV = new DataTable();
|
|
Int32 StartRecord = (Convert.ToInt32(numericUpDown12.Value) * classSQL.intPocetNaStranu) - classSQL.intPocetNaStranu;
|
|
|
|
classSQL.SQL(sqlCommandRV, StartRecord, classSQL.intPocetNaStranu, out dtbRV);
|
|
dGVRV.DataSource = dtbRV;
|
|
|
|
Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
label20.Text = numericUpDown12.Value.ToString() + "/" + PocetStran.ToString();
|
|
if (PocetStran < 1) PocetStran = 1;
|
|
numericUpDown12.Maximum = PocetStran;
|
|
|
|
dataGVSetColumnSortMode(dGVRV, DataGridViewColumnSortMode.NotSortable);
|
|
setDGV(dGVRV, classUser.IndexRV, textBox15);
|
|
}
|
|
//dGVRV.Select();
|
|
|
|
/*
|
|
dGVRV.Visible = true;
|
|
//dGVRV = false;
|
|
lblZobrazenyPocet.Text = dGVRV.Rows.Count.ToString();
|
|
|
|
dGVRV.ClearSelection();
|
|
if (classUser.IndexRV < dGVRV.Rows.Count - 1 && classUser.IndexRV >0) dGVRV.Rows[classUser.IndexRV].Selected = true;
|
|
else if (dGVRV.Rows.Count != 0) dGVRV.Rows[dGVRV.Rows.Count - 1].Selected = true; //
|
|
if (dGVRV.Rows.Count != 0) dGVRV.FirstDisplayedScrollingRowIndex = dGVRV.SelectedRows[0].Index;
|
|
*/
|
|
|
|
}
|
|
|
|
private void tabPage4_Enter(object sender, EventArgs e)
|
|
{
|
|
|
|
dGVRV.MouseWheel += new MouseEventHandler(dGVRV_MouseWheel);
|
|
refreshRV();
|
|
/* if (textBox15.Enabled == true) textBox15.Focus();
|
|
else
|
|
{
|
|
dGVRV.Focus();
|
|
dGVRV.Select();
|
|
}
|
|
*/
|
|
}
|
|
|
|
private void dGVRV_MouseWheel(object sender, MouseEventArgs e)
|
|
{
|
|
if (e.Delta > 0 && numericUpDown12.Value < numericUpDown12.Maximum) numericUpDown12.Value++;
|
|
if (e.Delta < 0 && numericUpDown12.Value > numericUpDown12.Minimum) numericUpDown12.Value--;
|
|
}
|
|
|
|
private void rBVsetkyOBJRV_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
refreshRV();
|
|
}
|
|
|
|
private void rBPrijateRV_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshRV();
|
|
}
|
|
|
|
private void rBZaradeneDoVyrRV_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshRV();
|
|
}
|
|
|
|
private void rBVoVyrobeRV_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshRV();
|
|
}
|
|
|
|
private void dGVRV_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if ((dGVRV.Columns[e.ColumnIndex].Name == "DatumPrijatiaDoVyr" && dGVRV.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Prijatá") ||
|
|
(dGVRV.Columns[e.ColumnIndex].Name == "DatumOdosNaKontr" && dGVRV.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Vo výrobe"))
|
|
{
|
|
Int32 intIDVyroba = 0;
|
|
Int32 intIDDopyt = 0;
|
|
intIDVyroba = Convert.ToInt32(dGVRV.Rows[e.RowIndex].Cells["IDVyroba"].Value);
|
|
intIDDopyt = Convert.ToInt32(dGVRV.Rows[e.RowIndex].Cells["IDDopyt"].Value);
|
|
string strColumnName = dGVRV.Columns[e.ColumnIndex].Name.ToString();
|
|
|
|
string cmd = "UPDATE `mip`.`tabvyroba` SET `" + strColumnName + "` = DATE(NOW()) WHERE `IDVyroba`=" + intIDVyroba.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
if (strColumnName == "DatumPrijatiaDoVyr") cmd = "UPDATE `mip`.`tabdopyt` SET `StatusDopytu`= 'Zaradená do výroby' WHERE `IDCPOBJ`=" + intIDDopyt.ToString() + ";";
|
|
if (strColumnName == "DatumOdosNaKontr") cmd = "UPDATE `mip`.`tabdopyt` SET `StatusDopytu`= 'Na lapovni' WHERE `IDCPOBJ`=" + intIDDopyt.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
|
|
|
|
refreshRV();
|
|
}
|
|
|
|
}
|
|
|
|
bool bSignalRight;
|
|
Int32 eRowIndexRV;
|
|
Int32 eColumnIndexRV;
|
|
|
|
private void dGVRV_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
this.Controls.Remove(monthcal);
|
|
if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
|
{
|
|
eRowIndexRV = e.RowIndex;
|
|
eColumnIndexRV = e.ColumnIndex;
|
|
bSignalRight = true;
|
|
}
|
|
else bSignalRight = false;
|
|
|
|
}
|
|
|
|
MonthCalendar.Calendar monthcal = new MonthCalendar.Calendar();
|
|
|
|
private void dGVRV_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
if ((dGVRV.Columns[e.ColumnIndex].Name == "DatumPrijatiaDoVyr" && dGVRV.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Prijatá") ||
|
|
(dGVRV.Columns[e.ColumnIndex].Name == "DatumPrijatiaDoVyr" && dGVRV.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Zaradená do výroby") ||
|
|
(dGVRV.Columns[e.ColumnIndex].Name == "DatumOdosNaKontr" && dGVRV.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Vo výrobe") ||
|
|
(dGVRV.Columns[e.ColumnIndex].Name == "DatumOdosNaKontr" && dGVRV.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Na lapovni"))
|
|
{
|
|
|
|
if (bSignalRight == true)
|
|
{
|
|
|
|
int x = 0; int y = 0;
|
|
|
|
if (MousePosition.X + monthcal.Width + 50 > this.Width) x = MousePosition.X - monthcal.Width;
|
|
else x = MousePosition.X;
|
|
if (MousePosition.Y + monthcal.Height + 70 > this.Height) y = MousePosition.Y - monthcal.Height;
|
|
else y = MousePosition.Y;
|
|
monthcal.Location = new Point(x, y - 35);
|
|
|
|
monthcal.SelectDay += new SelectDayEventHandler(monthcalSelectRemove);
|
|
monthcal.MonthChanged += new ChangeMonthEventHandler(monthChange);
|
|
monthcal.YearChanged += new ChangeYearEventHandler(yearChange);
|
|
//monthCalendar1.NavNextMonthClick += new MonthCalendar.SelectDayEventHandler(this.monthNav);
|
|
//monthcal.SelectionMode = MonthCalendar.SelectionMode.smNone;
|
|
//monthcal.Leave += new System.EventHandler(monthcal_leave);
|
|
this.Controls.Add(monthcal);
|
|
monthcal.BringToFront();
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
void monthChange(object sender, MonthCalendar.ChangeMonthEventArgs e)
|
|
{
|
|
boolCloseCal = true;
|
|
}
|
|
|
|
void yearChange(object sender, MonthCalendar.ChangeYearEventArgs e)
|
|
{
|
|
boolCloseCal = true;
|
|
}
|
|
|
|
bool boolCloseCal = false;
|
|
string editDateRV;
|
|
void monthcalSelectRemove(object sender, MonthCalendar.SelectDayEventArgs e)
|
|
{
|
|
if (boolCloseCal == false)
|
|
{
|
|
string format = "yyyy-MM-dd";
|
|
|
|
editDateRV = e.Date.ToString(format);
|
|
|
|
Int32 intIDVyroba = 0;
|
|
Int32 intIDDopyt = 0;
|
|
intIDVyroba = Convert.ToInt32(dGVRV.Rows[eRowIndexRV].Cells["IDVyroba"].Value);
|
|
intIDDopyt = Convert.ToInt32(dGVRV.Rows[eRowIndexRV].Cells["IDDopyt"].Value);
|
|
string strColumnName = dGVRV.Columns[eColumnIndexRV].Name.ToString();
|
|
|
|
string cmd = "UPDATE `mip`.`tabvyroba` SET `" + strColumnName + "` = '" + editDateRV + "' WHERE `IDVyroba`=" + intIDVyroba.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
|
|
if (strColumnName == "DatumPrijatiaDoVyr") cmd = "UPDATE `mip`.`tabdopyt` SET `StatusDopytu`= 'Zaradená do výroby' WHERE `IDCPOBJ`=" + intIDDopyt.ToString() + ";";
|
|
if (strColumnName == "DatumOdosNaKontr") cmd = "UPDATE `mip`.`tabdopyt` SET `StatusDopytu`= 'Na lapovni' WHERE `IDCPOBJ`=" + intIDDopyt.ToString() + ";";
|
|
//cmd = "UPDATE `mip`.`tabdopyt` SET `StatusDopytu`= 'Zaradená do výroby' WHERE `IDCPOBJ`=" + intIDDopyt.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
|
|
monthcal.SelectDay -= new SelectDayEventHandler(monthcalSelectRemove);
|
|
monthcal.MonthChanged -= new ChangeMonthEventHandler(monthChange);
|
|
monthcal.YearChanged -= new ChangeYearEventHandler(yearChange);
|
|
this.Controls.Remove(monthcal);
|
|
}
|
|
boolCloseCal = false;
|
|
|
|
}
|
|
|
|
private void dGVRV_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
|
|
dGVRV.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dGVRV.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
dGVRV.Columns["TypDopytu"].HeaderText = "Typ dopytu";
|
|
dGVRV.Columns["StatusDopytu"].HeaderText = "Status dopytu";
|
|
dGVRV.Columns["ZakCislo"].HeaderText = "Zákazkové číslo";
|
|
dGVRV.Columns["NazovKontraktu"].Visible = false;
|
|
dGVRV.Columns["CisloOBJ"].HeaderText = "Číslo dopytu";
|
|
dGVRV.Columns["Material"].HeaderText = "Materiál";
|
|
dGVRV.Columns["UpravaMaterialu"].HeaderText = "Úprava materiálu";
|
|
dGVRV.Columns["DatumPrijatiaOBJ"].Visible = false;
|
|
dGVRV.Columns["DatumPotvrdeny"].HeaderText = "Potvrdený dátum";
|
|
dGVRV.Columns["Zakaznik"].HeaderText = "Zákazník";
|
|
dGVRV.Columns["IDVyrobok"].Visible = false;
|
|
dGVRV.Columns["PoznamkaOBJ"].HeaderText = "Poznámka";
|
|
dGVRV.Columns["PocetDoVyroby"].HeaderText = "Počet kusov do výroby";
|
|
dGVRV.Columns["CenaOBJ"].Visible = false;
|
|
dGVRV.Columns["IDUsers"].Visible = false;
|
|
dGVRV.Columns["IDCPOBJ"].Visible = false;
|
|
dGVRV.Columns["DatumPrijatiaDoVyr"].HeaderText = "Dátum prijatia do výroby";
|
|
dGVRV.Columns["DatumPrijatiaDoVyr"].DefaultCellStyle.Font = new System.Drawing.Font(dGVRV.Font.Name, dGVRV.Font.Size, FontStyle.Bold);
|
|
dGVRV.Columns["DatumVydMat"].HeaderText = "Dátum vydania materiálu";
|
|
dGVRV.Columns["PocetVydKusov"].HeaderText = "Počet vydaných kusov";
|
|
dGVRV.Columns["DatumOdosNaKontr"].HeaderText = "Dátum odoslania na kontrolu";
|
|
dGVRV.Columns["DatumOdosNaKontr"].DefaultCellStyle.Font = new System.Drawing.Font(dGVRV.Font.Name, dGVRV.Font.Size, FontStyle.Bold);
|
|
dGVRV.Columns["IDDopyt"].Visible = false;
|
|
dGVRV.Columns["IDVyroba"].Visible = false;
|
|
dGVRV.Columns["NazovVyrobku"].HeaderText = "Názov výrobku";
|
|
dGVRV.Columns["SpojeneRozmery"].HeaderText = "Spojené rozmery";
|
|
|
|
dGVRV.Columns["TypDopytu"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dGVRV.Columns["StatusDopytu"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dGVRV.Columns["ZakCislo"].Width = 62;
|
|
dGVRV.Columns["CisloOBJ"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dGVRV.Columns["Material"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dGVRV.Columns["UpravaMaterialu"].MinimumWidth = 60;
|
|
dGVRV.Columns["UpravaMaterialu"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dGVRV.Columns["DatumPotvrdeny"].MinimumWidth = 75;
|
|
dGVRV.Columns["Zakaznik"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dGVRV.Columns["PoznamkaOBJ"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dGVRV.Columns["PocetDoVyroby"].Width = 60;
|
|
dGVRV.Columns["DatumPrijatiaDoVyr"].Width = 75;
|
|
dGVRV.Columns["DatumVydMat"].Width = 70;
|
|
dGVRV.Columns["PocetVydKusov"].Width = 60;
|
|
dGVRV.Columns["DatumOdosNaKontr"].Width = 75;
|
|
dGVRV.Columns["NazovVyrobku"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dGVRV.Columns["SpojeneRozmery"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
|
|
if (button87.Text == "Zobrazenie (min)")
|
|
{
|
|
dGVRV.Columns["TypDopytu"].Visible = true;
|
|
dGVRV.Columns["CisloOBJ"].Visible = true;
|
|
dGVRV.Columns["DatumVydMat"].Visible = true;
|
|
dGVRV.Columns["PocetVydKusov"].Visible = true;
|
|
|
|
}
|
|
else
|
|
{
|
|
dGVRV.Columns["TypDopytu"].Visible = false;
|
|
dGVRV.Columns["CisloOBJ"].Visible = false;
|
|
dGVRV.Columns["DatumVydMat"].Visible = false;
|
|
dGVRV.Columns["PocetVydKusov"].Visible = false;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void button61_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel17.Visible == false) panel17.Visible = true;
|
|
else panel17.Visible = false;
|
|
}
|
|
|
|
private void textBox15_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshRV();
|
|
}
|
|
|
|
private void numericUpDown12_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
refreshRV();
|
|
}
|
|
|
|
private void panel18_Click(object sender, EventArgs e)
|
|
{
|
|
textBox15.Text = "";
|
|
checkBox12.Checked = false;
|
|
checkBox20.Checked = false;
|
|
checkBox13.Checked = true;
|
|
checkBox14.Checked = false;
|
|
checkBox17.Checked = false;
|
|
checkBox18.Checked = false;
|
|
checkBox19.Checked = false;
|
|
checkBox24.Checked = false;
|
|
//refreshRV();
|
|
}
|
|
|
|
private void panel47_Click(object sender, EventArgs e)
|
|
{
|
|
textBox15.Text = "";
|
|
checkBox12.Checked = true;
|
|
checkBox20.Checked = true;
|
|
checkBox13.Checked = true;
|
|
checkBox14.Checked = true;
|
|
checkBox17.Checked = true;
|
|
checkBox18.Checked = true;
|
|
checkBox19.Checked = true;
|
|
checkBox24.Checked = true;
|
|
|
|
}
|
|
|
|
|
|
private void button87_Click(object sender, EventArgs e)
|
|
{
|
|
if (button87.Text == "Zobrazenie (min)") button87.Text = "Zobrazenie (max)";
|
|
else button87.Text = "Zobrazenie (min)";
|
|
dGVRV_Paint(null, null);
|
|
}
|
|
|
|
private void radioButton4_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshRV();
|
|
}
|
|
|
|
private void radioButton5_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshRV();
|
|
}
|
|
|
|
private void checkBox12_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshRV();
|
|
}
|
|
|
|
private void checkBox20_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshRV();
|
|
}
|
|
|
|
private void checkBox13_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshRV();
|
|
}
|
|
|
|
private void checkBox14_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshRV();
|
|
}
|
|
|
|
private void checkBox17_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshRV();
|
|
}
|
|
|
|
private void checkBox18_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshRV();
|
|
}
|
|
|
|
private void checkBox19_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshRV();
|
|
}
|
|
|
|
private void checkBox24_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshRV();
|
|
}
|
|
|
|
|
|
int RVColorIndex = -1;
|
|
private void dGVRV_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
|
|
if (RVColorIndex != e.ColumnIndex && RVColorIndex != -1) dGVRV.Columns[RVColorIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
|
|
if (dGVRV.Columns[e.ColumnIndex].DefaultCellStyle.BackColor == Color.Empty)
|
|
{
|
|
dGVRV.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.GreenYellow;
|
|
RVColorIndex = e.ColumnIndex;
|
|
textBox15.Text = "";
|
|
textBox15.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
dGVRV.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
RVColorIndex = -1;
|
|
textBox15.Text = "";
|
|
textBox15.Enabled = false;
|
|
}
|
|
|
|
}
|
|
|
|
private void dGVRV_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
if (e.KeyCode == Keys.Down && dGVRV.SelectedRows[0].Index == classSQL.intPocetNaStranu - 1 && numericUpDown12.Value < PocetStran)
|
|
{
|
|
numericUpDown12.Value++;
|
|
dGVRV.CurrentCell = dGVRV.FirstDisplayedCell;
|
|
boolUp = true;
|
|
}
|
|
if (e.KeyCode == Keys.Up && dGVRV.SelectedRows[0].Index == 0 && numericUpDown12.Value > 1)
|
|
{
|
|
numericUpDown12.Value--;
|
|
dGVRV.CurrentCell = dGVRV[1, classSQL.intPocetNaStranu - 1];
|
|
boolDown = true;
|
|
}
|
|
if (e.KeyCode == Keys.PageDown && numericUpDown12.Value < PocetStran) numericUpDown12.Value++;
|
|
if (e.KeyCode == Keys.PageUp && numericUpDown12.Value > 1) numericUpDown12.Value--;
|
|
}
|
|
|
|
private void dGVRV_SelectionChanged(object sender, EventArgs e)
|
|
{
|
|
if (boolUp == true)
|
|
{
|
|
SendKeys.Send("{UP}");
|
|
boolUp = false;
|
|
}
|
|
if (boolDown == true)
|
|
{
|
|
SendKeys.Send("{DOWN}");
|
|
boolDown = false;
|
|
}
|
|
}
|
|
|
|
private void dGVRV_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
classUser.IndexRV = e.RowIndex;
|
|
}
|
|
|
|
|
|
#endregion Riadenie vyroby
|
|
|
|
#region Zoznam Vyrobkov
|
|
|
|
private void btnZobrazVykres_Click(object sender, EventArgs e)
|
|
{
|
|
string strZak = dGVZoznamVyrobkov.Rows[dGVZoznamVyrobkov.CurrentRow.Index].Cells["Zakaznik"].Value.ToString();
|
|
string strVyr = dGVZoznamVyrobkov.Rows[dGVZoznamVyrobkov.CurrentRow.Index].Cells["IDVyrobok"].Value.ToString();
|
|
|
|
Form zobrazVykres = new frmShowVykres(strZak, Convert.ToInt32(strVyr));
|
|
zobrazVykres.Show();
|
|
}
|
|
|
|
private void refreshZoznamVyrobkov()
|
|
{
|
|
|
|
int scrollBarHeight = 0;
|
|
if (dGVZoznamVyrobkov.Controls.OfType<HScrollBar>().First().Visible == true) scrollBarHeight = dGVZoznamVyrobkov.Controls.OfType<HScrollBar>().First().Height;
|
|
int headerHeight = dGVZoznamVyrobkov.ColumnHeadersHeight;
|
|
if (headerHeight < 25) headerHeight = 47;
|
|
|
|
classSQL.intPocetNaStranu = Convert.ToInt32(Math.Floor((double)((dGVZoznamVyrobkov.Height - headerHeight - scrollBarHeight - 2) / 22)));
|
|
|
|
if (classSQL.intPocetNaStranu > 1)
|
|
{
|
|
if (dGVZoznamVyrobkov.SelectedRows.Count > 0) classUser.IndexZoznamVyrobkov = dGVZoznamVyrobkov.SelectedRows[0].Index;
|
|
else classUser.IndexZoznamVyrobkov = 0;
|
|
|
|
//string strCh10 = ""; string strCh11 = "";
|
|
string strTextBoxCondition = "";
|
|
|
|
if (textBox6.Text == "") strTextBoxCondition = "";
|
|
else strTextBoxCondition = " AND INSTR(`" + dGVZoznamVyrobkov.Columns[intIndexZV].Name.ToString() + "`, '" + textBox6.Text + "')>0";
|
|
|
|
string sqlCommandZoznamVyrobkov = "SELECT * FROM `mip`.`pohladvyrobok` WHERE `NazovVyrobku` != ''" + strTextBoxCondition + ";";
|
|
DataTable dtbZoznamVyrobkov = new DataTable();
|
|
Int32 StartRecord = (Convert.ToInt32(numericUpDown4.Value) * classSQL.intPocetNaStranu) - classSQL.intPocetNaStranu;
|
|
|
|
classSQL.SQL(sqlCommandZoznamVyrobkov, StartRecord, classSQL.intPocetNaStranu, out dtbZoznamVyrobkov);
|
|
dGVZoznamVyrobkov.DataSource = dtbZoznamVyrobkov;
|
|
dGVZoznamVyrobkov.Visible = true;
|
|
|
|
Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
label12.Text = numericUpDown4.Value.ToString() + "/" + PocetStran.ToString();
|
|
if (PocetStran < 1) PocetStran = 1;
|
|
numericUpDown4.Maximum = PocetStran;
|
|
|
|
//classUser.boolEnableRowEnter = true; // odblokuje
|
|
|
|
dataGVSetColumnSortMode(dGVZoznamVyrobkov, DataGridViewColumnSortMode.NotSortable);
|
|
setDGV(dGVZoznamVyrobkov, classUser.IndexExpedicia, textBox6);
|
|
|
|
//lblZobrazenyPocet.Text = dGVExpedicia.Rows.Count.ToString();
|
|
/*
|
|
lblZobrazenyPocet.Text = dGVZoznamVyrobkov.Rows.Count.ToString();
|
|
if (dGVZoznamVyrobkov.Rows.Count == 0) btnEditVyrobok.Enabled = false;
|
|
else btnEditVyrobok.Enabled = true;
|
|
|
|
dGVZoznamVyrobkov.ClearSelection();
|
|
if (classUser.IndexVyrobok < dGVZoznamVyrobkov.Rows.Count - 1) dGVZoznamVyrobkov.Rows[classUser.IndexVyrobok].Selected = true;
|
|
else if (dGVZoznamVyrobkov.Rows.Count != 0) dGVZoznamVyrobkov.Rows[dGVZoznamVyrobkov.Rows.Count - 1].Selected = true;
|
|
dGVZoznamVyrobkov.FirstDisplayedScrollingRowIndex = dGVZoznamVyrobkov.SelectedRows[0].Index;
|
|
*/
|
|
}
|
|
}
|
|
|
|
private void tabPage2_Enter(object sender, EventArgs e)
|
|
{
|
|
refreshZoznamVyrobkov();
|
|
}
|
|
|
|
private void numericUpDown4_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZoznamVyrobkov();
|
|
}
|
|
|
|
private void textBox6_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZoznamVyrobkov();
|
|
}
|
|
|
|
private void panel10_Click(object sender, EventArgs e)
|
|
{
|
|
textBox6.Text = "";
|
|
|
|
}
|
|
|
|
private void btnPridatVyrobok_Click(object sender, EventArgs e)
|
|
{
|
|
button50.Enabled = false;
|
|
cBPridajvyrobok.Items.Clear();
|
|
classGlobal.FillCB(cBPridajvyrobok, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať zákazníka");
|
|
cBPridajvyrobok.SelectedItem = -1;
|
|
panelPridatVyrobok.Visible = true;
|
|
cBPridajvyrobok.Focus();
|
|
}
|
|
|
|
private void panelPridatVyrobok_Leave(object sender, EventArgs e)
|
|
{
|
|
panelPridatVyrobok.Visible = false;
|
|
cBPridajvyrobok.SelectedItem = -1;
|
|
}
|
|
|
|
private void button50_Click(object sender, EventArgs e)
|
|
{
|
|
panelPridatVyrobok.Visible = false;
|
|
cBPridajvyrobok.SelectedItem = -1;
|
|
Form Add = new frmPridatVyrobok(cBPridajvyrobok.Text.ToString());
|
|
Add.ShowDialog();
|
|
refreshZoznamVyrobkov();
|
|
//refreshSkladPrijem();
|
|
}
|
|
|
|
private void cBPridajvyrobok_SelectedValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (cBPridajvyrobok.SelectedIndex != -1) button50.Enabled = true;
|
|
else button50.Enabled = false;
|
|
}
|
|
|
|
private void button51_Click(object sender, EventArgs e)
|
|
{
|
|
Form Add = new frmAddPomUdaje();
|
|
Add.Text = "Pridať zákazníka";
|
|
DialogResult dr = Add.ShowDialog();
|
|
if (dr == DialogResult.OK)
|
|
{
|
|
cBPridajvyrobok.Items.Clear();
|
|
classGlobal.FillCB(cBPridajvyrobok, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať zákazníka");
|
|
cBPridajvyrobok.Text = classGlobal.strNovyPomocnyUdaj;
|
|
}
|
|
}
|
|
|
|
private void dGVZoznamVyrobkov_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
dGVZoznamVyrobkov.Columns["NazovVyrobku"].HeaderText = "Názov výrobku";
|
|
dGVZoznamVyrobkov.Columns["RozmerTvar"].HeaderText = "Tvar výrobku";
|
|
dGVZoznamVyrobkov.Columns["Rozmer1"].HeaderText = "1. rozmer";
|
|
dGVZoznamVyrobkov.Columns["Rozmer2"].HeaderText = "2. rozmer";
|
|
dGVZoznamVyrobkov.Columns["Rozmer3"].HeaderText = "3. rozmer";
|
|
dGVZoznamVyrobkov.Columns["SpojeneRozmery"].HeaderText = "Spojené rozmery";
|
|
dGVZoznamVyrobkov.Columns["Zakaznik"].HeaderText = "Zákazník";
|
|
dGVZoznamVyrobkov.Columns["InyNazov"].HeaderText = "Iný názov";
|
|
dGVZoznamVyrobkov.Columns["RozlisZnakKonecnaOp"].HeaderText = "Rozliš. znak, koneč. operácia";
|
|
dGVZoznamVyrobkov.Columns["Alias"].HeaderText = "Alias";
|
|
dGVZoznamVyrobkov.Columns["PocetSegmentov"].HeaderText = "Počet segmentov";
|
|
dGVZoznamVyrobkov.Columns["IDVyrobok"].HeaderText = "ID výrobok";
|
|
dGVZoznamVyrobkov.Columns["IDVyrobok"].Visible = false;
|
|
|
|
dGVZoznamVyrobkov.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dGVZoznamVyrobkov.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
dGVZoznamVyrobkov.AutoResizeColumns();
|
|
|
|
}
|
|
|
|
private void btnEditVyrobok_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
Form Add = new frmEditVyrobok(dGVZoznamVyrobkov.CurrentRow.Cells["IDVyrobok"].Value.ToString());
|
|
Add.ShowDialog();
|
|
refreshZoznamVyrobkov();
|
|
}
|
|
|
|
int intIndexZV = -1;
|
|
|
|
private void dGVZoznamVyrobkov_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
classGlobal.SetRowColorBack(dGVZoznamVyrobkov);
|
|
|
|
if (intIndexZV != e.ColumnIndex && intIndexZV != -1) dGVZoznamVyrobkov.Columns[intIndexZV].DefaultCellStyle.BackColor = Color.Empty;
|
|
|
|
if (dGVZoznamVyrobkov.Columns[e.ColumnIndex].DefaultCellStyle.BackColor == Color.Empty)
|
|
{
|
|
dGVZoznamVyrobkov.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.GreenYellow;
|
|
intIndexZV = e.ColumnIndex;
|
|
textBox6.Text = "";
|
|
textBox6.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
dGVZoznamVyrobkov.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
intIndexZV = -1;
|
|
textBox6.Text = "";
|
|
textBox6.Enabled = false;
|
|
refreshZoznamVyrobkov();
|
|
}
|
|
|
|
}
|
|
|
|
#endregion Zoznam Vyrobkov
|
|
|
|
#region Expedicia
|
|
|
|
|
|
|
|
bool bool_ZobrazVstupExp = false;
|
|
|
|
private void dGVExpedicia_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
xClickPos = e.X;
|
|
yClickPos = e.Y;
|
|
}
|
|
|
|
private void dGVExpedicia_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
|
|
classUser.IndexExpedicia = e.RowIndex;
|
|
dGVExpedicia.ClearSelection();
|
|
if (classUser.IndexExpedicia < 0) dGVExpedicia.Rows[0].Selected = true;
|
|
else dGVExpedicia.Rows[classUser.IndexExpedicia].Selected = true;
|
|
|
|
|
|
if (e.Button == System.Windows.Forms.MouseButtons.Right
|
|
&& e.RowIndex > -1
|
|
&& bool_ZobrazVstupExp == false)
|
|
{
|
|
if (dGVExpedicia.Rows[e.RowIndex].Cells["Typ dopytu"].Value.ToString() == "Objednávka" ||
|
|
dGVExpedicia.Rows[e.RowIndex].Cells["Typ dopytu"].Value.ToString() == "Objednávka do kontraktu")
|
|
{
|
|
if (dGVExpedicia.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Na lapovni" ||
|
|
dGVExpedicia.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Čiastočne odoslaná")
|
|
{
|
|
eRowIndex = e.RowIndex;
|
|
bool_ZobrazVstupExp = true;
|
|
ZobrazVstupExp(e.RowIndex);
|
|
}
|
|
if (dGVExpedicia.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Prijatá" ||
|
|
//dGVExpedicia.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Prijatý" ||
|
|
dGVExpedicia.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Zaradená do výroby" ||
|
|
dGVExpedicia.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Vo výrobe")
|
|
{
|
|
DialogResult dr = MessageBox.Show("Objednávka má status: " + dGVExpedicia.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() + ", Expedovať ?", "Upozornenie!", MessageBoxButtons.YesNo);
|
|
if (dr == DialogResult.Yes)
|
|
{
|
|
|
|
Int32 intPocetVydKusov = 0;
|
|
string pocetkusov = "";
|
|
bool cancel = false;
|
|
Int32 intIDdopyt = Convert.ToInt32(dGVExpedicia.Rows[e.RowIndex].Cells["IDCPOBJ"].Value.ToString());
|
|
string strZistiPocetVydKusov;
|
|
classSQL.SQL("SELECT `PocetVydKusov` FROM `mip`.`tabvyroba` WHERE `IDDopyt`=" + intIDdopyt.ToString() + ";", out strZistiPocetVydKusov);
|
|
if (strZistiPocetVydKusov != "") intPocetVydKusov = Convert.ToInt32(strZistiPocetVydKusov);
|
|
else
|
|
{
|
|
do
|
|
{
|
|
cancel = false;
|
|
pocetkusov = Microsoft.VisualBasic.Interaction.InputBox("Zadať počet kusov do výroby", "Zadať počet kusov do výroby");
|
|
|
|
if (pocetkusov == "") cancel = true;
|
|
|
|
} while (!Int32.TryParse(pocetkusov, out intPocetVydKusov) && cancel == false);
|
|
}
|
|
if (cancel == false)
|
|
{
|
|
string cmd = @"UPDATE `mip`.`tabvyroba` SET `DatumPrijatiaDoVyr` = DATE(NOW()),
|
|
`DatumVydMat` = DATE(NOW()),
|
|
`DatumOdosNaKontr` = DATE(NOW()),
|
|
`PocetVydKusov` =" + intPocetVydKusov.ToString() +
|
|
" WHERE `IDDopyt`=" + intIDdopyt.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
|
|
eRowIndex = e.RowIndex;
|
|
bool_ZobrazVstupExp = true;
|
|
ZobrazVstupExp(e.RowIndex);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (dGVExpedicia.Rows[e.RowIndex].Cells["Typ dopytu"].Value.ToString() == "Call Off" &&
|
|
dGVExpedicia.Rows[e.RowIndex].Cells["Výdaj zo skladu"].Value.ToString() == "Vybavený" &&
|
|
dGVExpedicia.Rows[e.RowIndex].Cells["StatusDopytu"].Value.ToString() == "Na lapovni")
|
|
{
|
|
DialogResult dr = MessageBox.Show("Výrobky pre tento Call Off boli vyskladnené!, Expedovať Call Off?", "Upozornenie!", MessageBoxButtons.YesNo);
|
|
if (dr == DialogResult.Yes)
|
|
{
|
|
string statusExp = "Odoslaný";
|
|
//update statusu v dopytoch pre call off
|
|
string cmd = "UPDATE `mip`.`tabdopyt` SET `StatusDopytu`='" + statusExp + "' WHERE `IDCPOBJ`=" + dGVExpedicia.Rows[e.RowIndex].Cells["IDCPOBJ"].Value.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
//vlozi zaznam do tabexpedicia o odoslani call off
|
|
cmd = @"INSERT INTO `mip`.`tabexpedicia` (`IDDopyt`, `PocetVyrDobrychKusov`, `PocetOdoslanychKusov`, `PocetKusovNaSklad`, `DatumOperacie`) VALUES ("
|
|
+ dGVExpedicia.Rows[e.RowIndex].Cells["IDCPOBJ"].Value.ToString() + ", "
|
|
+ "0" + ", "
|
|
+ dGVExpedicia.Rows[e.RowIndex].Cells["Počet zo skladu"].Value.ToString() + ", "
|
|
+ "0" + ", "
|
|
+ "DATE(NOW()) );";
|
|
classSQL.SQL(cmd);
|
|
//prekontroluje pocet kusov pre kontrakt a zmeni status kontraktu na odoslany ak je pocet odoslanych vacsi ako pozadovany
|
|
cmd = @"SELECT IFNULL(SUM(`PocetZoSkladu`),0) FROM pohladdopyty WHERE `NazovKontraktu` = '" + dGVExpedicia.Rows[e.RowIndex].Cells["Kontrakt"].Value.ToString() + @"'
|
|
AND `StatusDopytu` = 'Odoslaný';";
|
|
string strPocetOdoslanych;
|
|
classSQL.SQL(cmd, out strPocetOdoslanych);
|
|
string strIDCPOBJ;
|
|
cmd = @"SELECT IFNULL(`IDCPOBJ`,0) FROM pohladdopyty WHERE `CisloObj` = '" + dGVExpedicia.Rows[e.RowIndex].Cells["Kontrakt"].Value.ToString() + "' AND `NazovKontraktu` = '';";
|
|
classSQL.SQL(cmd, out strIDCPOBJ);
|
|
string strPozadovanyPocet;
|
|
cmd = @"SELECT IFNULL(`PocetKusov`,0) FROM pohladdopyty WHERE `IDCPOBJ` = '" + strIDCPOBJ + "';";
|
|
classSQL.SQL(cmd, out strPozadovanyPocet);
|
|
|
|
//if (strPocetOdoslanych == "") strPocetOdoslanych = "0";
|
|
//if (strPozadovanyPocet == "") strPozadovanyPocet = "0";
|
|
|
|
if (Convert.ToInt32(strPocetOdoslanych) >= Convert.ToInt32(strPozadovanyPocet))
|
|
{
|
|
cmd = "UPDATE `mip`.`tabdopyt` SET `StatusDopytu`='" + statusExp + "' WHERE `IDCPOBJ`=" + Convert.ToInt32(strIDCPOBJ) + ";";
|
|
classSQL.SQL(cmd);
|
|
MessageBox.Show("Požadovaný počet kusov (" + Convert.ToInt32(strPozadovanyPocet) + ") bol dosiahnutý. Celkový počet odoslaných kusov do kontraktu je: " + Convert.ToInt32(strPocetOdoslanych) + ". Status kontraktu bol zmenený na odoslaný!");
|
|
}
|
|
refreshExpedicia();
|
|
|
|
}
|
|
}
|
|
//refreshExpedicia();
|
|
}
|
|
|
|
}
|
|
|
|
private void ZobrazVstupExp(Int32 eRI)
|
|
{
|
|
|
|
#region definicia_controlov
|
|
dtpDatum = new DateTimePicker();
|
|
dtpDatum.Value = DateTime.Now;
|
|
dtpDatum.Location = new Point(1, 1);
|
|
dtpDatum.Size = new Size(160, 20);
|
|
Label lPocetDobVyrKus = new Label();
|
|
lPocetDobVyrKus.AutoSize = true;
|
|
lPocetDobVyrKus.Text = "Počet dobre vyrobených kusov:";
|
|
lPocetDobVyrKus.TextAlign = ContentAlignment.MiddleCenter;
|
|
lPocetDobVyrKus.Location = new Point(1, 25);
|
|
|
|
lTextBoxDobVyrKus.Size = new Size(160, 20);
|
|
lTextBoxDobVyrKus.Text = "";
|
|
lTextBoxDobVyrKus.Location = new Point(1, 42);
|
|
lTextBoxDobVyrKus.TextChanged += new EventHandler(ltextExp);//Prerobiť PDVks - PNaSKLAD
|
|
lTextBoxDobVyrKus.KeyPress += new KeyPressEventHandler(ltextExpKeyPress);
|
|
lTextBoxDobVyrKus.Enter += new EventHandler(tbEnter);
|
|
lTextBoxDobVyrKus.Leave += new EventHandler(tbLeave);
|
|
|
|
lPocetOdoslKus.AutoSize = true;
|
|
lPocetOdoslKus.Text = "Počet odosielaných kusov: ";
|
|
lPocetOdoslKus.TextAlign = ContentAlignment.MiddleCenter;
|
|
lPocetOdoslKus.Location = new Point(1, 66);
|
|
|
|
lTextBoxOdoslKus.Size = new Size(160, 20);
|
|
lTextBoxOdoslKus.Text = "";
|
|
lTextBoxOdoslKus.Location = new Point(1, 83);
|
|
lTextBoxOdoslKus.TextChanged += new EventHandler(ltextExp);
|
|
lTextBoxOdoslKus.KeyPress += new KeyPressEventHandler(ltextExpKeyPress);
|
|
lTextBoxOdoslKus.Enter += new EventHandler(tbEnter);
|
|
lTextBoxOdoslKus.Leave += new EventHandler(tbLeave);
|
|
|
|
lPocetKusNaSklad.AutoSize = true;
|
|
lPocetKusNaSklad.Text = "Počet kusov na sklad: ";
|
|
lPocetKusNaSklad.TextAlign = ContentAlignment.MiddleCenter;
|
|
lPocetKusNaSklad.Location = new Point(1, 108);
|
|
lPocetKusNaSklad.Visible = false;//=
|
|
|
|
lTextKusNaSklad.Size = new Size(160, 20);
|
|
lTextKusNaSklad.Text = "0";
|
|
lTextKusNaSklad.Location = new Point(1, 125);
|
|
lTextKusNaSklad.TextChanged += new EventHandler(ltextExp);
|
|
lTextKusNaSklad.KeyPress += new KeyPressEventHandler(ltextExpKeyPress);
|
|
lTextKusNaSklad.Visible = false;
|
|
lTextKusNaSklad.Enter += new EventHandler(tbEnter);
|
|
lTextKusNaSklad.Leave += new EventHandler(tbLeave);
|
|
|
|
rbUplna.Text = "Úplná";
|
|
rbUplna.Size = new Size(55, rbUplna.Size.Height);
|
|
rbUplna.Checked = true;
|
|
rbUplna.Location = new Point(3, 145);
|
|
|
|
|
|
rbNeuplna.Text = "Zatiaľ neúplná";
|
|
rbNeuplna.Checked = false;
|
|
rbNeuplna.Location = new Point(rbUplna.Size.Width + 5, rbUplna.Location.Y);
|
|
|
|
|
|
btnButtonExp.Size = new Size(162, 38);
|
|
btnButtonExp.Location = new Point(0, 168);
|
|
btnButtonExp.Enabled = false;
|
|
btnButtonExp.Text = "Uložiť počet";
|
|
|
|
pPocetKusovExp = new Panel();
|
|
pPocetKusovExp.Size = new Size(164, 208);
|
|
pPocetKusovExp.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
pPocetKusovExp.Name = "pPocetKusovExp";
|
|
|
|
int x = 0; int y = 0;
|
|
if (MousePosition.X + pPocetKusovExp.Width + 50 > this.Width) x = MousePosition.X - pPocetKusovExp.Width;
|
|
else x = MousePosition.X;
|
|
if (MousePosition.Y + pPocetKusovExp.Height + 70 > this.Height) y = MousePosition.Y - pPocetKusovExp.Height;
|
|
else y = MousePosition.Y;
|
|
pPocetKusovExp.Location = new Point(x - 10, y - 25);
|
|
|
|
pPocetKusovExp.Controls.Add(lPocetDobVyrKus);
|
|
pPocetKusovExp.Controls.Add(lTextBoxDobVyrKus);
|
|
pPocetKusovExp.Controls.Add(lPocetOdoslKus);
|
|
pPocetKusovExp.Controls.Add(lTextBoxOdoslKus);
|
|
pPocetKusovExp.Controls.Add(lPocetKusNaSklad);
|
|
//pPocetKusovExp.Controls.Add(chbNaSkklad);
|
|
pPocetKusovExp.Controls.Add(lTextKusNaSklad);
|
|
pPocetKusovExp.Controls.Add(rbUplna);
|
|
pPocetKusovExp.Controls.Add(rbNeuplna);
|
|
pPocetKusovExp.Controls.Add(dtpDatum);
|
|
|
|
|
|
pPocetKusovExp.Controls.Add(btnButtonExp);
|
|
pPocetKusovExp.Leave += new EventHandler(pPocetKusovExp_Leave);
|
|
this.Controls.Add(pPocetKusovExp);
|
|
|
|
|
|
|
|
lTextBoxDobVyrKus.Focus();
|
|
#endregion definicia_controlov
|
|
|
|
btnButtonExp.Click += new EventHandler(SaveClosePanelExp);
|
|
|
|
pPocetKusovExp.BringToFront();
|
|
}
|
|
void tbEnter(object sender, EventArgs e)
|
|
{
|
|
if (sender is TextBox)
|
|
{
|
|
TextBox tB = (TextBox)sender;
|
|
tB.BackColor = Color.Azure;
|
|
}
|
|
}
|
|
void tbLeave(object sender, EventArgs e)
|
|
{
|
|
if (sender is TextBox)
|
|
{
|
|
TextBox tB = (TextBox)sender;
|
|
tB.BackColor = Color.White;
|
|
}
|
|
}
|
|
void pPocetKusovExp_Leave(object sender, EventArgs e)
|
|
{
|
|
btnButtonExp.Click -= new EventHandler(SaveClosePanelExp);
|
|
this.Controls.Remove(pPocetKusovExp);
|
|
bool_ZobrazVstupExp = false;
|
|
|
|
}
|
|
|
|
//Control controlToDeleteExp;
|
|
DateTimePicker dtpDatum;
|
|
Label lPocetKusNaSklad = new Label();
|
|
Label lPocetOdoslKus = new Label();
|
|
TextBox lTextKusNaSklad = new TextBox();
|
|
TextBox lTextBoxDobVyrKus = new TextBox();
|
|
TextBox lTextBoxOdoslKus = new TextBox();
|
|
//CheckBox chbNaSkklad = new CheckBox();
|
|
RadioButton rbUplna = new RadioButton();
|
|
RadioButton rbNeuplna = new RadioButton();
|
|
Button btnButtonExp = new Button();
|
|
Panel pPocetKusovExp;
|
|
|
|
//Kliknutie buttonu na paneli - ulozenie kusov v expedícii
|
|
void SaveClosePanelExp(object sender, EventArgs e)//=PK ÚPRAVY=
|
|
{
|
|
//Peto
|
|
Int32 intIDVyrobok = 0;
|
|
Int32 intIDDopyt = 0;
|
|
intIDVyrobok = Convert.ToInt32(dGVExpedicia.Rows[eRowIndex].Cells["IDVyrobok"].Value);
|
|
intIDDopyt = Convert.ToInt32(dGVExpedicia.Rows[eRowIndex].Cells["IDCPOBJ"].Value);
|
|
string strMat = dGVExpedicia.Rows[eRowIndex].Cells["Materiál"].Value.ToString();
|
|
string strUMat = dGVExpedicia.Rows[eRowIndex].Cells["Úprava materiálu"].Value.ToString();
|
|
string strMatUMat;
|
|
if (strUMat == "") strMatUMat = strMat;
|
|
else strMatUMat = strMat + " + " + strUMat;
|
|
|
|
string statusExp = "";
|
|
if (rbNeuplna.Checked) statusExp = "Čiastočne odoslaná";
|
|
if (rbUplna.Checked) statusExp = "Odoslaná";
|
|
|
|
string cmd = "UPDATE `mip`.`tabdopyt` SET `StatusDopytu`='" + statusExp + "' WHERE `IDCPOBJ`=" + intIDDopyt.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
Int32 intIndex;
|
|
cmd = @"INSERT INTO `mip`.`tabexpedicia` (`IDDopyt`, `PocetVyrDobrychKusov`, `PocetOdoslanychKusov`, `PocetKusovNaSklad`, `DatumOperacie`) VALUES ("
|
|
+ intIDDopyt.ToString() + ", "
|
|
+ lTextBoxDobVyrKus.Text.ToString() + ", "
|
|
+ lTextBoxOdoslKus.Text.ToString() + ", "
|
|
+ lTextKusNaSklad.Text.ToString() + ", '"
|
|
+ dtpDatum.Value.ToString("yyyy-MM-dd") + "');";
|
|
classSQL.SQL(cmd, out intIndex);
|
|
|
|
//DataTable d2 = classSQL.commandSQL("SELECT last_insert_id()", 1);
|
|
|
|
if (lTextKusNaSklad.Text != "" && lTextKusNaSklad.Text != "0")
|
|
{
|
|
string strTypoperacie;
|
|
|
|
cmd = @"DELETE FROM `mip`.`tabskladvyrobkov`
|
|
WHERE `IDDopyt` = "
|
|
+ intIDDopyt.ToString()
|
|
+ " AND `SkladOperacia`='Rezervovaný výdaj';";
|
|
|
|
classSQL.SQL(cmd);
|
|
|
|
if (Convert.ToInt32(lTextBoxDobVyrKus.Text) >= Convert.ToInt32(lTextBoxOdoslKus.Text)) strTypoperacie = "'Príjem'";
|
|
else strTypoperacie = "'Výdaj'";
|
|
|
|
//Sem ideme vkladat kod pre obsluhu rezervovaných kusov
|
|
|
|
string strIDHladanyZaznam;
|
|
cmd = "SELECT IFNULL ((SELECT IDOperacia FROM tabskladvyrobkov WHERE IDDopyt = " + intIDDopyt.ToString() + " AND IDVyr = " + intIDVyrobok.ToString() + "),0) AS IDOperacia;";
|
|
classSQL.SQL(cmd, out strIDHladanyZaznam);
|
|
|
|
cmd = @"INSERT INTO `mip`.`tabskladvyrobkov` (`SkladOperacia`, `StatusSkladOperacie`, `IDvyr`, `IDExpedicia`, `IDDopyt`, `MaterialSUpravouMat`, `Pocet`, `DatumVytvorenia`) VALUES ("
|
|
+ strTypoperacie + ", "
|
|
+ "'Nevybavený'" + ", "
|
|
+ intIDVyrobok.ToString() + ", "
|
|
+ intIndex.ToString() + ", "
|
|
+ "0" + ", '"
|
|
+ strMatUMat + "', "
|
|
+ lTextKusNaSklad.Text.ToString() + ", '"
|
|
+ dtpDatum.Value.ToString("yyyy-MM-dd") + "');";
|
|
if (strTypoperacie == "'Príjem'" && lTextKusNaSklad.Text != "0") classSQL.SQL(cmd);
|
|
if (strTypoperacie == "'Výdaj'" && lTextKusNaSklad.Text != "0" && strIDHladanyZaznam == "0") classSQL.SQL(cmd);
|
|
|
|
//if (lTextKusNaSklad.Text != "0" && strIDHladanyZaznam == "0") classSQL.SQL(cmd); //if (Convert.ToInt32(lTextBoxDobVyrKus.Text) >= 0 && lTextKusNaSklad.Text != "0") classSQL.SQL(cmd); //strIDHladanyZaznam, 2014.09.17 zmena z > na >= z dovodu ze zdenke nevkladalo zaznamy do sklad operacii v pripadek ked mala 0 vyrobenych
|
|
|
|
}
|
|
else
|
|
{
|
|
cmd = @"DELETE FROM `mip`.`tabskladvyrobkov`
|
|
WHERE `IDDopyt` = "
|
|
+ intIDDopyt.ToString()
|
|
+ " AND `SkladOperacia`='Rezervovaný výdaj';";
|
|
classSQL.SQL(cmd);
|
|
}
|
|
|
|
MessageBox.Show("Operácia úspešná!");
|
|
btnButtonExp.Click -= new EventHandler(SaveClosePanelExp);
|
|
this.Controls.Remove(pPocetKusovExp);
|
|
|
|
bool_ZobrazVstupExp = false;
|
|
|
|
}
|
|
|
|
private void dGVExpedicia_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
|
{
|
|
//classGlobal.SetRowColor(dGVExpedicia, e.ColumnIndex, e.RowIndex, e.Value.ToString());
|
|
}
|
|
|
|
void ltextExp(object sender, EventArgs e)//=PK UPRAVY=
|
|
{
|
|
|
|
if (lTextBoxDobVyrKus.Text != "" && lTextBoxOdoslKus.Text != "")
|
|
{
|
|
if (lTextBoxDobVyrKus.Text != lTextBoxOdoslKus.Text)
|
|
{
|
|
int pocetDobVyrKus = Convert.ToInt32(lTextBoxDobVyrKus.Text);
|
|
int pocetOdoslKus = Convert.ToInt32(lTextBoxOdoslKus.Text);
|
|
int pocetNaSklade;
|
|
int pocetDoZoSkladu;
|
|
|
|
#region Zistiť poČet kusov na sklade
|
|
|
|
Int32 intIDVyrobok = 0;
|
|
Int32 intIDDopyt = 0;
|
|
intIDVyrobok = Convert.ToInt32(dGVExpedicia.Rows[dGVExpedicia.SelectedRows[0].Index].Cells["IDVyrobok"].Value);
|
|
intIDDopyt = Convert.ToInt32(dGVExpedicia.Rows[dGVExpedicia.SelectedRows[0].Index].Cells["IDCPOBJ"].Value);
|
|
string strMat = dGVExpedicia.Rows[dGVExpedicia.SelectedRows[0].Index].Cells["Materiál"].Value.ToString();
|
|
string strUMat = dGVExpedicia.Rows[dGVExpedicia.SelectedRows[0].Index].Cells["Úprava materiálu"].Value.ToString();
|
|
string strMatUMat;
|
|
if (strUMat == "") strMatUMat = strMat;
|
|
else strMatUMat = strMat + " + " + strUMat;
|
|
|
|
string cmd = @"SELECT
|
|
IFNULL((SELECT SUM(`tabskladvyrobkov`.Pocet) FROM `tabskladvyrobkov`
|
|
WHERE (`tabskladvyrobkov`.SkladOperacia = 'Príjem' OR `tabskladvyrobkov`.SkladOperacia = 'Inventárny príjem')AND
|
|
`tabskladvyrobkov`.StatusSkladOperacie = 'Vybavený' AND
|
|
`tabskladvyrobkov`.MaterialSUpravouMat = '" + strMatUMat + @"' AND
|
|
`tabskladvyrobkov`.IDvyr = " + intIDVyrobok.ToString() + @"),0)
|
|
-
|
|
IFNULL((SELECT SUM(`tabskladvyrobkov`.Pocet) FROM `tabskladvyrobkov`
|
|
WHERE (`tabskladvyrobkov`.SkladOperacia = 'Výdaj' OR `tabskladvyrobkov`.SkladOperacia = 'Rezervovaný výdaj' ) AND
|
|
(`tabskladvyrobkov`.StatusSkladOperacie = 'Vybavený' OR `tabskladvyrobkov`.StatusSkladOperacie = 'Nevybavený') AND
|
|
`tabskladvyrobkov`.MaterialSUpravouMat = '" + strMatUMat + @"' AND
|
|
`tabskladvyrobkov`.IDvyr = " + intIDVyrobok.ToString() + @"),0)
|
|
+
|
|
(SELECT `tabdopyt`.PocetZoSkladu FROM `tabdopyt`
|
|
WHERE `tabdopyt`.IDCPOBJ = " + intIDDopyt.ToString() + @")
|
|
|
|
AS `TotalNaSklade`";
|
|
string strTotalNaSklade;
|
|
classSQL.SQL(cmd, out strTotalNaSklade);
|
|
if (strTotalNaSklade != "") pocetNaSklade = Convert.ToInt32(strTotalNaSklade);
|
|
else pocetNaSklade = 0;
|
|
#endregion
|
|
|
|
//pocetNaSklade = 10;//vyhodiť
|
|
|
|
btnButtonExp.Enabled = false;
|
|
if (lTextKusNaSklad.Text != "") pocetDoZoSkladu = Convert.ToInt32(lTextKusNaSklad.Text);
|
|
else pocetDoZoSkladu = 0;
|
|
|
|
if (pocetDobVyrKus > pocetOdoslKus)
|
|
{
|
|
lPocetKusNaSklad.Text = "Počet ks NA SKLAD: (" + pocetNaSklade.ToString() + ")";
|
|
//lTextKusNaSklad.Text=(pocetDobVyrKus - pocetOdoslKus).ToString();
|
|
if (pocetDobVyrKus >= pocetOdoslKus + pocetDoZoSkladu) btnButtonExp.Enabled = true;
|
|
}
|
|
|
|
if (pocetDobVyrKus < pocetOdoslKus)
|
|
{
|
|
lPocetKusNaSklad.Text = "Počet ks ZO SKLADU: (" + pocetNaSklade.ToString() + ")";
|
|
lTextKusNaSklad.Text = (pocetOdoslKus - pocetDobVyrKus).ToString();
|
|
if (pocetNaSklade >= pocetDoZoSkladu && pocetOdoslKus == pocetDobVyrKus + pocetDoZoSkladu) btnButtonExp.Enabled = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
lPocetKusNaSklad.Visible = true;
|
|
lTextKusNaSklad.Visible = true;
|
|
|
|
}
|
|
|
|
else
|
|
{
|
|
|
|
lPocetKusNaSklad.Visible = false;
|
|
lTextKusNaSklad.Text = "0";
|
|
lTextKusNaSklad.Visible = false;
|
|
btnButtonExp.Enabled = true;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
lPocetKusNaSklad.Visible = false;
|
|
lTextKusNaSklad.Text = "0";
|
|
lTextKusNaSklad.Visible = false;
|
|
btnButtonExp.Enabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
void ltextExpKeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
TextBox tb = sender as TextBox;
|
|
int intResult;
|
|
if (!(int.TryParse(tb.Text + e.KeyChar, out intResult)) && (int)e.KeyChar != 8) e.KeyChar = '\0';
|
|
}
|
|
|
|
private void dGVExpedicia_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
|
|
dGVExpedicia.Columns["StatusDopytu"].HeaderText = "Status dopytu";
|
|
dGVExpedicia.Columns["IDCPOBJ"].Visible = false;
|
|
dGVExpedicia.Columns["IDVyrobok"].Visible = false;
|
|
dGVExpedicia.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dGVExpedicia.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
//nastavenie velkosti stlpcov
|
|
dGVExpedicia.Columns["Potvrdený dátum"].Width = 70;
|
|
dGVExpedicia.Columns["Zákazník"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dGVExpedicia.Columns["Číslo objednávky"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dGVExpedicia.Columns["Názov výrobku"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dGVExpedicia.Columns["Rozmery"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dGVExpedicia.Columns["Zákazkové číslo"].Width = 62;
|
|
dGVExpedicia.Columns["Typ dopytu"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dGVExpedicia.Columns["Kontrakt"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dGVExpedicia.Columns["Objednaný počet kusov"].Width = 60;
|
|
dGVExpedicia.Columns["Cena za kus"].Width = 50;
|
|
dGVExpedicia.Columns["Materiál"].Width = 60;
|
|
dGVExpedicia.Columns["Úprava materiálu"].Width = 60;
|
|
dGVExpedicia.Columns["Počet kusov do výroby"].Width = 60;
|
|
dGVExpedicia.Columns["Počet zo skladu"].Width = 60;
|
|
dGVExpedicia.Columns["Počet vydaných kusov"].Width = 60;
|
|
dGVExpedicia.Columns["Počet vyrobených dobrých kusov"].Width = 64;
|
|
dGVExpedicia.Columns["Počet odoslaných kusov"].Width = 64;
|
|
dGVExpedicia.Columns["Počet kusov na sklad"].Width = 60;
|
|
dGVExpedicia.Columns["Dátum expedície"].Width = 70;
|
|
dGVExpedicia.Columns["Dátum prijatia objenávky"].Width = 70;
|
|
dGVExpedicia.Columns["StatusDopytu"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dGVExpedicia.Columns["Poznámka"].MinimumWidth = 60;
|
|
dGVExpedicia.Columns["Poznámka"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dGVExpedicia.Columns["Výdaj zo skladu"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
|
|
|
|
|
|
if (button82.Text == "Zobrazenie (min)")
|
|
{
|
|
dGVExpedicia.Columns["Rozmery"].Visible = true;
|
|
dGVExpedicia.Columns["Kontrakt"].Visible = true;
|
|
dGVExpedicia.Columns["Cena za kus"].Visible = true;
|
|
dGVExpedicia.Columns["Materiál"].Visible = true;
|
|
dGVExpedicia.Columns["Úprava materiálu"].Visible = true;
|
|
dGVExpedicia.Columns["Počet vydaných kusov"].Visible = true;
|
|
dGVExpedicia.Columns["Dátum prijatia objenávky"].Visible = true;
|
|
dGVExpedicia.Columns["StatusDopytu"].Visible = true;
|
|
dGVExpedicia.Columns["Poznámka"].Visible = true;
|
|
dGVExpedicia.Columns["Výdaj zo skladu"].Visible = true;
|
|
}
|
|
else
|
|
{
|
|
dGVExpedicia.Columns["Rozmery"].Visible = false;
|
|
dGVExpedicia.Columns["Kontrakt"].Visible = false;
|
|
dGVExpedicia.Columns["Cena za kus"].Visible = false;
|
|
dGVExpedicia.Columns["Materiál"].Visible = false;
|
|
dGVExpedicia.Columns["Úprava materiálu"].Visible = false;
|
|
dGVExpedicia.Columns["Počet vydaných kusov"].Visible = false;
|
|
dGVExpedicia.Columns["Dátum prijatia objenávky"].Visible = false;
|
|
dGVExpedicia.Columns["StatusDopytu"].Visible = false;
|
|
dGVExpedicia.Columns["Poznámka"].Visible = false;
|
|
dGVExpedicia.Columns["Výdaj zo skladu"].Visible = false;
|
|
}
|
|
|
|
if (EXPColorIndex == -1) classGlobal.SetRowColor2(dGVExpedicia, "StatusDopytu");
|
|
else classGlobal.SetRowColorBack(dGVExpedicia);
|
|
}
|
|
|
|
void chbExp(object sender, EventArgs e)
|
|
{
|
|
CheckBox chb = sender as CheckBox;
|
|
|
|
if (chb.Checked == true)
|
|
{
|
|
|
|
}
|
|
else btnButtonExp.Enabled = true;
|
|
|
|
}
|
|
|
|
private void refreshExpedicia()
|
|
{
|
|
|
|
int scrollBarHeight = 0;
|
|
|
|
if (dGVExpedicia.Controls.OfType<HScrollBar>().First().Visible == true) scrollBarHeight = dGVExpedicia.Controls.OfType<HScrollBar>().First().Height;
|
|
int headerHeight = dGVExpedicia.ColumnHeadersHeight;
|
|
if (headerHeight < 25) headerHeight = 57;
|
|
classSQL.intPocetNaStranu = Convert.ToInt32(Math.Floor((double)((dGVExpedicia.Height - headerHeight - scrollBarHeight - 2) / 22)));
|
|
|
|
if (classSQL.intPocetNaStranu > 1)
|
|
{
|
|
if (dGVExpedicia.SelectedRows.Count > 0) classUser.IndexExpedicia = dGVExpedicia.SelectedRows[0].Index; //Convert.ToInt32(dGVExpedicia[dGVExpedicia.Columns["IDCPOBJ"].Index, dGVExpedicia.SelectedRows[0].Index].RowIndex);
|
|
else classUser.IndexExpedicia = 0;
|
|
|
|
string strCheckBoxStatusCondition = " AND(`StatusDopytu` = 'Prázdna hodnota'";
|
|
foreach (CheckBox chb in groupBox23.Controls)
|
|
{
|
|
if (chb.Checked) strCheckBoxStatusCondition = strCheckBoxStatusCondition + " OR `StatusDopytu` = '" + chb.Text + "'";
|
|
}
|
|
strCheckBoxStatusCondition = strCheckBoxStatusCondition + ")";
|
|
|
|
string strCheckBoxTypCondition = " (`Typ Dopytu` = 'Prázdna hodnota'";
|
|
foreach (CheckBox chb in groupBox15.Controls)
|
|
{
|
|
if (chb.Checked) strCheckBoxTypCondition = strCheckBoxTypCondition + " OR `Typ Dopytu` = '" + chb.Text + "'";
|
|
}
|
|
strCheckBoxTypCondition = strCheckBoxTypCondition + ")";
|
|
|
|
string strTextBoxCondition = "";
|
|
if (EXPColorIndex >= 0) strTextBoxCondition = " AND INSTR(`" + dGVExpedicia.Columns[EXPColorIndex].Name + "`, '" + textBox13.Text + "')>0 ";
|
|
|
|
string sqlCommandExpedicia;
|
|
sqlCommandExpedicia = @"SELECT * FROM `pohladexpedicia` WHERE " + strCheckBoxTypCondition + strCheckBoxStatusCondition + strTextBoxCondition + " ORDER BY `Potvrdený dátum`, `Zákazník`, `IDCPOBJ`;";
|
|
|
|
//classUser.boolEnableRowEnter = false; // zablokuje a nedovoli vykonavat ine funkcie, v tomto pripade rowenter event
|
|
DataTable dtbExpedicia = new DataTable();
|
|
Int32 StartRecord = (Convert.ToInt32(numericUpDown10.Value) * classSQL.intPocetNaStranu) - classSQL.intPocetNaStranu;
|
|
|
|
classSQL.SQL(sqlCommandExpedicia, checkBox60.Checked, StartRecord, classSQL.intPocetNaStranu, out dtbExpedicia);
|
|
dGVExpedicia.DataSource = dtbExpedicia;
|
|
dGVExpedicia.Visible = true;
|
|
dGVExpedicia.AutoResizeColumns();
|
|
|
|
// novy vypocet stran
|
|
|
|
//Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
label18.Text = "Strana: " + numericUpDown10.Value.ToString();
|
|
//if (PocetStran < 1) PocetStran = 1;
|
|
//numericUpDown10.Maximum = numericUpDown10.Value;
|
|
NUDmaximumChange(numericUpDown10, dGVExpedicia.Rows.Count, classSQL.intPocetNaStranu);
|
|
|
|
// povodny vypocet stran
|
|
/*
|
|
Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
label18.Text = numericUpDown10.Value.ToString() + "/" + PocetStran.ToString();
|
|
if (PocetStran < 1) PocetStran = 1;
|
|
numericUpDown10.Maximum = PocetStran;
|
|
*/
|
|
|
|
//classUser.boolEnableRowEnter = true; // odblokuje
|
|
|
|
dataGVSetColumnSortMode(dGVExpedicia, DataGridViewColumnSortMode.NotSortable);
|
|
setDGV(dGVExpedicia, classUser.IndexExpedicia, textBox13);
|
|
|
|
//lblZobrazenyPocet.Text = dGVExpedicia.Rows.Count.ToString();
|
|
}
|
|
}
|
|
|
|
private void NUDmaximumChange(NumericUpDown nud, int dgvRowCount, int pocetNaStranu)
|
|
{
|
|
nud.Maximum = nud.Value;
|
|
if (dgvRowCount == pocetNaStranu) nud.Maximum++;
|
|
}
|
|
|
|
private void tabPage6_Enter(object sender, EventArgs e)
|
|
{
|
|
refreshExpedicia();
|
|
}
|
|
|
|
|
|
private void button60_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel15.Visible == false) panel15.Visible = true;
|
|
else panel15.Visible = false;
|
|
numericUpDown10.Maximum = dGVExpedicia.Columns.Count - 1;
|
|
label18.Text = dGVExpedicia.Columns[0].HeaderText;
|
|
/**/
|
|
}
|
|
|
|
private void panel16_Click(object sender, EventArgs e)
|
|
{
|
|
textBox13.Text = "";
|
|
checkBox22.Checked = true;
|
|
checkBox23.Checked = true;
|
|
checkBox21.Checked = true;
|
|
checkBox36.Checked = false;
|
|
checkBox31.Checked = false;
|
|
checkBox32.Checked = false;
|
|
checkBox30.Checked = true;
|
|
checkBox33.Checked = true;
|
|
checkBox34.Checked = true;
|
|
checkBox35.Checked = false;
|
|
refreshExpedicia();
|
|
}
|
|
|
|
private void checkBox36_Click(object sender, EventArgs e)
|
|
{
|
|
if (checkBox36.Checked == true)
|
|
{
|
|
checkBox31.Checked = true;
|
|
checkBox32.Checked = true;
|
|
checkBox30.Checked = true;
|
|
checkBox33.Checked = true;
|
|
checkBox34.Checked = true;
|
|
checkBox35.Checked = true;
|
|
}
|
|
else
|
|
{
|
|
checkBox31.Checked = false;
|
|
checkBox32.Checked = false;
|
|
checkBox30.Checked = false;
|
|
checkBox33.Checked = false;
|
|
checkBox34.Checked = false;
|
|
checkBox35.Checked = false;
|
|
}
|
|
refreshExpedicia();
|
|
}
|
|
|
|
private void checkBox22_Click(object sender, EventArgs e)
|
|
{
|
|
refreshExpedicia();
|
|
}
|
|
|
|
private void checkBox23_Click(object sender, EventArgs e)
|
|
{
|
|
refreshExpedicia();
|
|
}
|
|
|
|
private void checkBox21_Click(object sender, EventArgs e)
|
|
{
|
|
refreshExpedicia();
|
|
}
|
|
|
|
private void checkBox31_Click(object sender, EventArgs e)
|
|
{
|
|
refreshExpedicia();
|
|
}
|
|
|
|
private void checkBox32_Click(object sender, EventArgs e)
|
|
{
|
|
refreshExpedicia();
|
|
}
|
|
|
|
private void checkBox30_Click(object sender, EventArgs e)
|
|
{
|
|
refreshExpedicia();
|
|
}
|
|
|
|
private void checkBox33_Click(object sender, EventArgs e)
|
|
{
|
|
refreshExpedicia();
|
|
}
|
|
|
|
private void checkBox34_Click(object sender, EventArgs e)
|
|
{
|
|
refreshExpedicia();
|
|
}
|
|
|
|
private void checkBox35_Click(object sender, EventArgs e)
|
|
{
|
|
refreshExpedicia();
|
|
}
|
|
|
|
private void textBox13_TextChanged(object sender, EventArgs e)
|
|
{
|
|
//refreshExpedicia();
|
|
}
|
|
|
|
private void textBox12_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshExpedicia();
|
|
}
|
|
|
|
private void numericUpDown10_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
refreshExpedicia();
|
|
}
|
|
|
|
private void button66_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
if (dGVExpedicia.SelectedRows[0].Cells["StatusDopytu"].Value.ToString() != "Pozastavená" &&
|
|
dGVExpedicia.SelectedRows[0].Cells["StatusDopytu"].Value.ToString() != "Zrušená")
|
|
{
|
|
Form frmEditExpedicia2 = new frmEditExpedicia(dGVExpedicia.SelectedRows[0].Cells["IDCPOBJ"].Value.ToString());
|
|
frmEditExpedicia2.ShowDialog();
|
|
}
|
|
else MessageBox.Show("Expedičné záznamy nie je možné editovať!");
|
|
}
|
|
|
|
|
|
private void button82_Click(object sender, EventArgs e)
|
|
{
|
|
if (button82.Text == "Zobrazenie (min)") button82.Text = "Zobrazenie (max)";
|
|
else button82.Text = "Zobrazenie (min)";
|
|
dGVExpedicia_Paint(null, null);
|
|
}
|
|
|
|
int EXPColorIndex = -1;
|
|
private void dGVExpedicia_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
classGlobal.SetRowColorBack(dGVExpedicia);
|
|
|
|
if (EXPColorIndex != e.ColumnIndex && EXPColorIndex != -1) dGVExpedicia.Columns[EXPColorIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
|
|
if (dGVExpedicia.Columns[e.ColumnIndex].DefaultCellStyle.BackColor == Color.Empty)
|
|
{
|
|
dGVExpedicia.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.GreenYellow;
|
|
EXPColorIndex = e.ColumnIndex;
|
|
textBox13.Text = "";
|
|
textBox13.Enabled = true;
|
|
button110.Enabled = true;
|
|
//label19.Text = "Hľadať v stĺpci: " + dataGridView1.Columns[e.ColumnIndex].HeaderText;
|
|
}
|
|
else
|
|
{
|
|
dGVExpedicia.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
EXPColorIndex = -1;
|
|
textBox13.Text = "";
|
|
textBox13.Enabled = false;
|
|
button110.Enabled = false;
|
|
//label19.Text = "Hľadať v stĺpci: ---";
|
|
classGlobal.SetRowColor2(dGVExpedicia, "StatusDopytu");
|
|
refreshExpedicia();
|
|
}
|
|
|
|
}
|
|
|
|
private void button110_Click(object sender, EventArgs e)
|
|
{
|
|
if (numericUpDown1.Value != 1) numericUpDown10.Value = 1;
|
|
else refreshExpedicia();
|
|
|
|
}
|
|
|
|
|
|
#endregion Expedicia
|
|
|
|
#region Sklad vyrobkov
|
|
|
|
private void tabPage5_Enter(object sender, EventArgs e)
|
|
{
|
|
|
|
refreshSkladPrijem();
|
|
refreshSkladVydaj();
|
|
|
|
}
|
|
|
|
void refreshSkladPrijem()
|
|
{
|
|
string strCh10 = ""; string strCh11 = "";
|
|
string strTextBoxCondition = "";
|
|
|
|
string strZobrazPrijem = "";
|
|
if (checkBox4.Checked == true) strZobrazPrijem = "Príjem";
|
|
string strZobrazINVPrijem = "";
|
|
if (checkBox5.Checked == true) strZobrazINVPrijem = "Inventárny príjem";
|
|
string strZobrazPrijemVybaveny = "";
|
|
if (checkBox9.Checked == true) strZobrazPrijemVybaveny = "Vybavený";
|
|
string strZobrazPrijemNevybaveny = "";
|
|
if (checkBox8.Checked == true) strZobrazPrijemNevybaveny = "Nevybaveny";
|
|
|
|
if (textBox9.Text == "") strCh10 = "";
|
|
else strCh10 = " AND INSTR(`" + dGVSkladPrijem.Columns[Convert.ToInt32(numericUpDown6.Value)].Name.ToString() + "`, '" + textBox9.Text + "')>0";
|
|
if (textBox8.Text == "") strCh11 = "";
|
|
else strCh11 = " AND INSTR(`" + dGVSkladPrijem.Columns[Convert.ToInt32(numericUpDown5.Value)].Name.ToString() + "`, '" + textBox8.Text + "')>0";
|
|
strTextBoxCondition = strCh10.ToString() + strCh11.ToString();
|
|
|
|
string cmd1 = "SELECT * FROM `pohladskladprijem` WHERE (`SkladOperacia` = '" + strZobrazPrijem + "' OR `SkladOperacia` = '" + strZobrazINVPrijem +
|
|
"') AND (`StatusSkladOperacie` = '" + strZobrazPrijemVybaveny + "' OR `StatusSkladOperacie` = '" + strZobrazPrijemNevybaveny +
|
|
"')" + strTextBoxCondition + " ORDER BY `DatumPotvrdeny` ;";
|
|
|
|
DataTable dtbSkladPrijem = new DataTable();
|
|
classSQL.SQL(cmd1, out dtbSkladPrijem);
|
|
dGVSkladPrijem.DataSource = dtbSkladPrijem;
|
|
dGVSkladPrijem.Visible = true;
|
|
lblZobrazenyPocet.Text = dGVSkladPrijem.Rows.Count.ToString() + "+" + dGVSkladVydaj.Rows.Count.ToString();
|
|
|
|
}
|
|
void refreshSkladVydaj()
|
|
{
|
|
string strCh10 = ""; string strCh11 = "";
|
|
string strTextBoxCondition = "";
|
|
|
|
string strZobrazVydaj = "";
|
|
if (checkBox7.Checked == true) strZobrazVydaj = "Výdaj";
|
|
string strZobrazINVVydaj = "";
|
|
if (checkBox6.Checked == true) strZobrazINVVydaj = "Inventárny výdaj";
|
|
string strZobrazVydajVybaveny = "";
|
|
if (checkBox11.Checked == true) strZobrazVydajVybaveny = "Vybavený";
|
|
string strZobrazVydajNevybaveny = "";
|
|
if (checkBox10.Checked == true) strZobrazVydajNevybaveny = "Nevybaveny";
|
|
|
|
if (textBox11.Text == "") strCh10 = "";
|
|
else strCh10 = " AND INSTR(`" + dGVSkladVydaj.Columns[Convert.ToInt32(numericUpDown8.Value)].Name.ToString() + "`, '" + textBox11.Text + "')>0";
|
|
if (textBox10.Text == "") strCh11 = "";
|
|
else strCh11 = " AND INSTR(`" + dGVSkladVydaj.Columns[Convert.ToInt32(numericUpDown7.Value)].Name.ToString() + "`, '" + textBox10.Text + "')>0";
|
|
strTextBoxCondition = strCh10.ToString() + strCh11.ToString();
|
|
|
|
string cmd2 = "SELECT * FROM `pohladskladvydaj` WHERE (`SkladOperacia` = '" + strZobrazVydaj + "' OR `SkladOperacia` = '" + strZobrazINVVydaj +
|
|
"') AND (`StatusSkladOperacie` = '" + strZobrazVydajVybaveny + "' OR `StatusSkladOperacie` = '" + strZobrazVydajNevybaveny +
|
|
"')" + strTextBoxCondition + " ORDER BY `DatumPotvrdeny`;";
|
|
|
|
DataTable dtbSkladVydaj = new DataTable();
|
|
classSQL.SQL(cmd2, out dtbSkladVydaj);
|
|
dGVSkladVydaj.DataSource = dtbSkladVydaj;
|
|
dGVSkladVydaj.Visible = true;
|
|
lblZobrazenyPocet.Text = dGVSkladPrijem.Rows.Count.ToString() + "+" + dGVSkladVydaj.Rows.Count.ToString();
|
|
|
|
}
|
|
|
|
int hodnotaPredKlikomSkladPrijem = 0;
|
|
private void numericUpDown6_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (dGVSkladPrijem.Columns[Convert.ToInt32(numericUpDown6.Value)].Visible == true)
|
|
{
|
|
if (Convert.ToInt32(numericUpDown6.Value) < dGVSkladPrijem.Columns.Count) label14.Text = dGVSkladPrijem.Columns[Convert.ToInt32(numericUpDown6.Value)].HeaderText;
|
|
hodnotaPredKlikomSkladPrijem = Convert.ToInt32(numericUpDown6.Value);
|
|
}
|
|
else
|
|
{
|
|
if (hodnotaPredKlikomSkladPrijem > Convert.ToInt32(numericUpDown6.Value))
|
|
{
|
|
numericUpDown6.Value -= 1;
|
|
}
|
|
else if (Convert.ToInt32(numericUpDown6.Value) < dGVSkladPrijem.ColumnCount - 1) numericUpDown6.Value += 1;
|
|
hodnotaPredKlikomSkladPrijem = Convert.ToInt32(numericUpDown6.Value);
|
|
}
|
|
refreshSkladPrijem();
|
|
|
|
}
|
|
|
|
int hodnotaPredKlikomSkladPrijem2 = 0;
|
|
private void numericUpDown5_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (dGVSkladPrijem.Columns[Convert.ToInt32(numericUpDown5.Value)].Visible == true)
|
|
{
|
|
if (Convert.ToInt32(numericUpDown5.Value) < dGVSkladPrijem.Columns.Count) label13.Text = dGVSkladPrijem.Columns[Convert.ToInt32(numericUpDown5.Value)].HeaderText;
|
|
hodnotaPredKlikomSkladPrijem2 = Convert.ToInt32(numericUpDown5.Value);
|
|
}
|
|
else
|
|
{
|
|
if (hodnotaPredKlikomSkladPrijem2 > Convert.ToInt32(numericUpDown5.Value))
|
|
{
|
|
numericUpDown5.Value -= 1;
|
|
}
|
|
else if (Convert.ToInt32(numericUpDown5.Value) < dGVSkladPrijem.ColumnCount - 1) numericUpDown5.Value += 1;
|
|
hodnotaPredKlikomSkladPrijem2 = Convert.ToInt32(numericUpDown5.Value);
|
|
}
|
|
refreshSkladPrijem();
|
|
}
|
|
|
|
private void textBox9_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshSkladPrijem();
|
|
}
|
|
|
|
private void textBox8_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshSkladPrijem();
|
|
}
|
|
|
|
private void checkBox4_Click(object sender, EventArgs e)
|
|
{
|
|
refreshSkladPrijem();
|
|
}
|
|
|
|
private void checkBox5_Click(object sender, EventArgs e)
|
|
{
|
|
refreshSkladPrijem();
|
|
}
|
|
|
|
private void checkBox9_Click(object sender, EventArgs e)
|
|
{
|
|
refreshSkladPrijem();
|
|
}
|
|
|
|
private void checkBox8_Click(object sender, EventArgs e)
|
|
{
|
|
refreshSkladPrijem();
|
|
}
|
|
|
|
private void textBox11_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshSkladVydaj();
|
|
}
|
|
|
|
private void textBox10_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshSkladVydaj();
|
|
}
|
|
|
|
private void checkBox7_Click(object sender, EventArgs e)
|
|
{
|
|
refreshSkladVydaj();
|
|
}
|
|
|
|
private void checkBox6_Click(object sender, EventArgs e)
|
|
{
|
|
refreshSkladVydaj();
|
|
}
|
|
|
|
private void checkBox11_Click(object sender, EventArgs e)
|
|
{
|
|
refreshSkladVydaj();
|
|
}
|
|
|
|
private void checkBox10_Click(object sender, EventArgs e)
|
|
{
|
|
refreshSkladVydaj();
|
|
}
|
|
|
|
private void button58_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel11.Visible == false) panel11.Visible = true;
|
|
else panel11.Visible = false;
|
|
numericUpDown6.Maximum = dGVSkladPrijem.Columns.Count - 1;
|
|
numericUpDown5.Maximum = dGVSkladPrijem.Columns.Count - 1;
|
|
label14.Text = dGVSkladPrijem.Columns[0].HeaderText;
|
|
label13.Text = dGVSkladPrijem.Columns[0].HeaderText;
|
|
}
|
|
|
|
private void button59_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel13.Visible == false) panel13.Visible = true;
|
|
else panel13.Visible = false;
|
|
numericUpDown8.Maximum = dGVSkladVydaj.Columns.Count - 1;
|
|
numericUpDown7.Maximum = dGVSkladVydaj.Columns.Count - 1;
|
|
label16.Text = dGVSkladVydaj.Columns[0].HeaderText;
|
|
label15.Text = dGVSkladVydaj.Columns[0].HeaderText;
|
|
}
|
|
|
|
int hodnotaPredKlikomSkladVydaj = 0;
|
|
private void numericUpDown8_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (dGVSkladVydaj.Columns[Convert.ToInt32(numericUpDown8.Value)].Visible == true)
|
|
{
|
|
if (Convert.ToInt32(numericUpDown8.Value) < dGVSkladVydaj.Columns.Count) label16.Text = dGVSkladVydaj.Columns[Convert.ToInt32(numericUpDown8.Value)].HeaderText;
|
|
hodnotaPredKlikomSkladVydaj = Convert.ToInt32(numericUpDown8.Value);
|
|
}
|
|
else
|
|
{
|
|
if (hodnotaPredKlikomSkladVydaj > Convert.ToInt32(numericUpDown8.Value))
|
|
{
|
|
numericUpDown8.Value -= 1;
|
|
}
|
|
else if (Convert.ToInt32(numericUpDown8.Value) < dGVSkladVydaj.ColumnCount - 1) numericUpDown8.Value += 1;
|
|
hodnotaPredKlikomSkladVydaj = Convert.ToInt32(numericUpDown8.Value);
|
|
}
|
|
refreshSkladVydaj();
|
|
}
|
|
|
|
int hodnotaPredKlikomSkladVydaj2 = 0;
|
|
private void numericUpDown7_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (dGVSkladVydaj.Columns[Convert.ToInt32(numericUpDown7.Value)].Visible == true)
|
|
{
|
|
if (Convert.ToInt32(numericUpDown7.Value) < dGVSkladVydaj.Columns.Count) label15.Text = dGVSkladVydaj.Columns[Convert.ToInt32(numericUpDown7.Value)].HeaderText;
|
|
hodnotaPredKlikomSkladVydaj2 = Convert.ToInt32(numericUpDown7.Value);
|
|
}
|
|
else
|
|
{
|
|
if (hodnotaPredKlikomSkladVydaj2 > Convert.ToInt32(numericUpDown7.Value))
|
|
{
|
|
numericUpDown7.Value -= 1;
|
|
}
|
|
else if (Convert.ToInt32(numericUpDown7.Value) < dGVSkladVydaj.ColumnCount - 1) numericUpDown7.Value += 1;
|
|
hodnotaPredKlikomSkladVydaj2 = Convert.ToInt32(numericUpDown7.Value);
|
|
}
|
|
refreshSkladVydaj();
|
|
}
|
|
|
|
private void panel12_Click(object sender, EventArgs e)
|
|
{
|
|
textBox9.Text = "";
|
|
textBox8.Text = "";
|
|
checkBox4.Checked = true;
|
|
checkBox5.Checked = true;
|
|
checkBox9.Checked = false;
|
|
checkBox8.Checked = true;
|
|
|
|
refreshSkladPrijem();
|
|
}
|
|
|
|
private void panel14_Click(object sender, EventArgs e)
|
|
{
|
|
textBox11.Text = "";
|
|
textBox10.Text = "";
|
|
checkBox7.Checked = true;
|
|
checkBox6.Checked = true;
|
|
checkBox11.Checked = false;
|
|
checkBox10.Checked = true;
|
|
|
|
refreshSkladVydaj();
|
|
}
|
|
|
|
|
|
private void btnPridajInvPrijem_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
Form frmPrijem = new frmInventar();
|
|
frmPrijem.Text = "Inventárny príjem";
|
|
frmPrijem.ShowDialog();
|
|
refreshSkladPrijem();
|
|
}
|
|
|
|
private void btnPridajInvVydaj_Click(object sender, EventArgs e)
|
|
{
|
|
Form frmPrijem = new frmInventar();
|
|
frmPrijem.Text = "Inventárny výdaj";
|
|
frmPrijem.ShowDialog();
|
|
refreshSkladVydaj();
|
|
}
|
|
|
|
private void dGVSkladPrijem_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (dGVSkladPrijem.Rows[e.RowIndex].Cells["StatusSkladOperacie"].Value.ToString() == "Nevybavený")
|
|
{
|
|
Int32 intIDOperacia = 0;
|
|
intIDOperacia = Convert.ToInt32(dGVSkladPrijem.Rows[e.RowIndex].Cells["IDOperacia"].Value);
|
|
|
|
Form prijem = new frmPrijemDoSkladu(intIDOperacia);
|
|
prijem.ShowDialog();
|
|
refreshSkladPrijem();
|
|
}
|
|
}
|
|
|
|
|
|
private void dGVSkladVydaj_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (dGVSkladVydaj.Rows[e.RowIndex].Cells["StatusSkladOperacie"].Value.ToString() == "Nevybavený")
|
|
{
|
|
Int32 intIDOperacia = 0;
|
|
intIDOperacia = Convert.ToInt32(dGVSkladVydaj.Rows[e.RowIndex].Cells["IDOperacia"].Value);
|
|
|
|
Form vydaj = new frmVydajZoSkladu(intIDOperacia);
|
|
vydaj.ShowDialog();
|
|
refreshSkladVydaj();
|
|
}
|
|
}
|
|
|
|
|
|
private void button6_Click(object sender, EventArgs e)
|
|
{
|
|
if (button6.Text == "-")
|
|
{
|
|
button6.Text = "+";
|
|
button65.Text = "-";
|
|
splitContainer1.SplitterDistance = 25;
|
|
}
|
|
else
|
|
{
|
|
button6.Text = "-";
|
|
splitContainer1.SplitterDistance = (int)splitContainer1.Size.Height / 2;
|
|
}
|
|
|
|
}
|
|
private void button65_Click(object sender, EventArgs e)
|
|
{
|
|
if (button65.Text == "-")
|
|
{
|
|
button65.Text = "+";
|
|
button6.Text = "-";
|
|
splitContainer1.SplitterDistance = (int)splitContainer1.Size.Height - 25;
|
|
}
|
|
else
|
|
{
|
|
button65.Text = "-";
|
|
splitContainer1.SplitterDistance = (int)splitContainer1.Size.Height / 2;
|
|
}
|
|
}
|
|
|
|
private void dGVSkladPrijem_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
dGVSkladPrijem.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dGVSkladPrijem.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
dGVSkladPrijem.Columns["SkladOperacia"].HeaderText = "Skladová operácia";
|
|
dGVSkladPrijem.Columns["StatusSkladOperacie"].HeaderText = "Status skladovej operácie";
|
|
dGVSkladPrijem.Columns["ZAKCIS"].HeaderText = "Zákazkové číslo";
|
|
dGVSkladPrijem.Columns["IDvyr"].Visible = false;
|
|
dGVSkladPrijem.Columns["NazovVyrobku2"].HeaderText = "Názov výrobku";
|
|
dGVSkladPrijem.Columns["SpojeneRozmery"].HeaderText = "Spojené rozmery";
|
|
dGVSkladPrijem.Columns["IDExpedicia"].Visible = false;
|
|
dGVSkladPrijem.Columns["IDDopyt"].Visible = false;
|
|
dGVSkladPrijem.Columns["MaterialSUpravouMat"].HeaderText = "Materiál + úprava materiálu";
|
|
dGVSkladPrijem.Columns["Pocet"].HeaderText = "Počet kusov";
|
|
dGVSkladPrijem.Columns["DatumVytvorenia"].HeaderText = "Dátum vytvorenia operácie";
|
|
dGVSkladPrijem.Columns["DatumVykonania"].HeaderText = "Dátum vykonania operácie";
|
|
dGVSkladPrijem.Columns["IDOperacia"].Visible = false;
|
|
|
|
dGVSkladPrijem.AutoResizeColumns();
|
|
|
|
}
|
|
|
|
private void dGVSkladVydaj_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
dGVSkladVydaj.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dGVSkladVydaj.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
dGVSkladVydaj.Columns["SkladOperacia"].HeaderText = "Skladová operácia";
|
|
dGVSkladVydaj.Columns["StatusSkladOperacie"].HeaderText = "Status skladovej operácie";
|
|
dGVSkladVydaj.Columns["ZAKCIS"].HeaderText = "Zákazkové číslo";
|
|
dGVSkladVydaj.Columns["IDvyr"].Visible = false;
|
|
dGVSkladVydaj.Columns["NazovVyrobku2"].HeaderText = "Názov výrobku";
|
|
dGVSkladVydaj.Columns["SpojeneRozmery"].HeaderText = "Spojené rozmery";
|
|
dGVSkladVydaj.Columns["IDExpedicia"].Visible = false;
|
|
dGVSkladVydaj.Columns["IDDopyt"].Visible = false;
|
|
dGVSkladVydaj.Columns["MaterialSUpravouMat"].HeaderText = "Materiál + úprava materiálu";
|
|
dGVSkladVydaj.Columns["Pocet"].HeaderText = "Počet kusov";
|
|
dGVSkladVydaj.Columns["DatumVytvorenia"].HeaderText = "Dátum vytvorenia operácie";
|
|
dGVSkladVydaj.Columns["DatumVykonania"].HeaderText = "Dátum vykonania operácie";
|
|
dGVSkladVydaj.Columns["IDOperacia"].Visible = false;
|
|
|
|
dGVSkladVydaj.AutoResizeColumns();
|
|
}
|
|
|
|
|
|
|
|
#endregion Sklad vyrobkov
|
|
|
|
#region Zoznam Strojov
|
|
|
|
private void button64_Click(object sender, EventArgs e)
|
|
{
|
|
if (button64.Text == "-")
|
|
{
|
|
button64.Text = "+";
|
|
button69.Text = "-";
|
|
splitContainer2.SplitterDistance = 25;
|
|
}
|
|
else
|
|
{
|
|
button64.Text = "-";
|
|
splitContainer2.SplitterDistance = (int)splitContainer2.Size.Height / 2;
|
|
}
|
|
}
|
|
|
|
private void button69_Click(object sender, EventArgs e)
|
|
{
|
|
if (button69.Text == "-")
|
|
{
|
|
button69.Text = "+";
|
|
button64.Text = "-";
|
|
splitContainer2.SplitterDistance = (int)splitContainer2.Size.Height - 25;
|
|
}
|
|
else
|
|
{
|
|
button69.Text = "-";
|
|
splitContainer2.SplitterDistance = (int)splitContainer2.Size.Height / 2;
|
|
}
|
|
}
|
|
|
|
private void button68_Click(object sender, EventArgs e)
|
|
{
|
|
panelPridajStroj.Visible = true;
|
|
button76.Enabled = false;
|
|
comboBox2.Items.Clear();
|
|
comboBox3.Items.Clear();
|
|
textBox24.Text = "";
|
|
textBox25.Text = "";
|
|
textBox26.Text = "";
|
|
textBox27.Text = "";
|
|
classGlobal.FillCB(comboBox2, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať typ stroja");
|
|
classGlobal.FillCB(comboBox3, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať dieľňu");
|
|
comboBox2.SelectedItem = -1;
|
|
comboBox3.SelectedItem = -1;
|
|
comboBox2.Focus();
|
|
}
|
|
|
|
private void panelPridajStroj_Leave(object sender, EventArgs e)
|
|
{
|
|
panelPridajStroj.Visible = false;
|
|
//cBPridajvyrobok.SelectedItem = -1;
|
|
}
|
|
|
|
private void button71_Click(object sender, EventArgs e)
|
|
{
|
|
string stroj = "";
|
|
stroj = dGVStroje.Rows[dGVStroje.SelectedRows[0].Index].Cells["Vyrobca"].Value.ToString() + " - " + dGVStroje.Rows[dGVStroje.SelectedRows[0].Index].Cells["ModelStroja"].Value.ToString();
|
|
label38.Text = stroj;
|
|
|
|
panelPridatPU.Visible = true;
|
|
button77.Enabled = false;
|
|
comboBox9.Items.Clear();
|
|
comboBox9.Text = "";
|
|
textBox28.Text = "";
|
|
comboBox9.Items.Add("Denne");
|
|
comboBox9.Items.Add("Týždenne");
|
|
comboBox9.Items.Add("Mesačne");
|
|
comboBox9.Items.Add("Štvrťročne");
|
|
comboBox9.Items.Add("Ročne");
|
|
comboBox9.Items.Add("5-ročne");
|
|
comboBox9.SelectedItem = -1;
|
|
comboBox9.Focus();
|
|
}
|
|
|
|
private void panelPridatPU_Leave(object sender, EventArgs e)
|
|
{
|
|
if (panel27.Visible == false) panelPridatPU.Visible = false;
|
|
}
|
|
|
|
|
|
|
|
private void button74_Click(object sender, EventArgs e)
|
|
{
|
|
Form Add = new frmAddPomUdaje();
|
|
Add.Text = "Pridať typ stroja";
|
|
DialogResult dr = Add.ShowDialog();
|
|
if (dr == DialogResult.OK)
|
|
{
|
|
comboBox2.Items.Clear();
|
|
classGlobal.FillCB(comboBox2, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať typ stroja");
|
|
comboBox2.Text = classGlobal.strNovyPomocnyUdaj;
|
|
}
|
|
}
|
|
|
|
private void button75_Click(object sender, EventArgs e)
|
|
{
|
|
Form Add = new frmAddPomUdaje();
|
|
Add.Text = "Pridať dieľňu";
|
|
DialogResult dr = Add.ShowDialog();
|
|
if (dr == DialogResult.OK)
|
|
{
|
|
comboBox3.Items.Clear();
|
|
classGlobal.FillCB(comboBox3, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať dieľňu");
|
|
comboBox3.Text = classGlobal.strNovyPomocnyUdaj;
|
|
}
|
|
}
|
|
|
|
private void comboBox2_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (comboBox2.Text != "")
|
|
{
|
|
button75.Enabled = true;
|
|
label31.Enabled = true;
|
|
comboBox3.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
button75.Enabled = false;
|
|
label31.Enabled = false;
|
|
comboBox3.Enabled = false;
|
|
}
|
|
|
|
}
|
|
|
|
private void comboBox3_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (comboBox3.Text != "")
|
|
{
|
|
label32.Enabled = true;
|
|
textBox24.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
label32.Enabled = false;
|
|
textBox24.Enabled = false;
|
|
}
|
|
}
|
|
|
|
private void textBox24_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (textBox24.Text != "")
|
|
{
|
|
label33.Enabled = true;
|
|
textBox25.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
label33.Enabled = false;
|
|
textBox25.Enabled = false;
|
|
}
|
|
}
|
|
|
|
private void textBox25_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (textBox25.Text != "")
|
|
{
|
|
label36.Enabled = true;
|
|
textBox27.Enabled = true;
|
|
label34.Enabled = true;
|
|
dateTimePicker1.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
label36.Enabled = false;
|
|
textBox27.Enabled = false;
|
|
label34.Enabled = false;
|
|
dateTimePicker1.Enabled = false;
|
|
}
|
|
}
|
|
|
|
private void textBox27_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (textBox27.Text != "")
|
|
{
|
|
label35.Enabled = true;
|
|
textBox26.Enabled = true;
|
|
button76.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
label35.Enabled = false;
|
|
textBox26.Enabled = false;
|
|
button76.Enabled = false;
|
|
}
|
|
}
|
|
|
|
private void button76_Click(object sender, EventArgs e)
|
|
{
|
|
string cmd = "";
|
|
string format = "yyyy-MM-dd";
|
|
|
|
cmd = @"INSERT INTO `mip`.`tabstroje` ( `Vyrobca`,
|
|
`ModelStroja`,
|
|
`TypStroja`,
|
|
`DatumZaradenia`,
|
|
`Dielna`,
|
|
`Poznamka`,
|
|
`INVCislo`) VALUES ('"
|
|
+ textBox24.Text + "', '"
|
|
+ textBox25.Text + "', '"
|
|
+ comboBox2.Text + "', '"
|
|
+ dateTimePicker1.Value.ToString(format) + "', '"
|
|
+ comboBox3.Text.ToString() + "', '"
|
|
+ textBox26.Text.ToString() + "', "
|
|
+ textBox27.Text.ToString() + ")";
|
|
classSQL.SQL(cmd);
|
|
panelPridajStroj.Visible = false;
|
|
}
|
|
|
|
private void refreshStroje()
|
|
{
|
|
|
|
string strCh10 = ""; string strCh11 = "";
|
|
string strTextBoxCondition = "";
|
|
|
|
if (textBox19.Text == "") strCh10 = "";
|
|
else strCh10 = " AND INSTR(`" + dGVStroje.Columns[Convert.ToInt32(numericUpDown16.Value)].Name.ToString() + "`, '" + textBox19.Text + "')>0";
|
|
if (textBox18.Text == "") strCh11 = "";
|
|
else strCh11 = " AND INSTR(`" + dGVStroje.Columns[Convert.ToInt32(numericUpDown15.Value)].Name.ToString() + "`, '" + textBox18.Text + "')>0";
|
|
strTextBoxCondition = strCh10.ToString() + strCh11.ToString();
|
|
|
|
string sqlCommandStroje = "SELECT * FROM `mip`.`tabstroje` WHERE `Vyrobca` != ''" + strTextBoxCondition + ";";
|
|
DataTable dtbStroje = new DataTable();
|
|
classSQL.SQL(sqlCommandStroje, out dtbStroje);
|
|
dGVStroje.DataSource = dtbStroje;
|
|
lblZobrazenyPocet.Text = dGVStroje.Rows.Count.ToString();
|
|
|
|
}
|
|
|
|
private void tabPage10_Enter(object sender, EventArgs e)
|
|
{
|
|
refreshStroje();
|
|
}
|
|
|
|
private void panel22_Click(object sender, EventArgs e)
|
|
{
|
|
textBox18.Text = "";
|
|
textBox19.Text = "";
|
|
}
|
|
|
|
private void textBox19_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshStroje();
|
|
}
|
|
|
|
private void textBox18_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshStroje();
|
|
}
|
|
|
|
Int32 hodnotaPredKlikomStroje;
|
|
private void numericUpDown16_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
if (dGVStroje.Columns[Convert.ToInt32(numericUpDown16.Value)].Visible == true)
|
|
{
|
|
if (Convert.ToInt32(numericUpDown16.Value) < dGVStroje.Columns.Count) label25.Text = dGVStroje.Columns[Convert.ToInt32(numericUpDown16.Value)].HeaderText;
|
|
hodnotaPredKlikomStroje = Convert.ToInt32(numericUpDown16.Value);
|
|
}
|
|
else
|
|
{
|
|
if (hodnotaPredKlikomStroje > Convert.ToInt32(numericUpDown16.Value))
|
|
{
|
|
numericUpDown16.Value -= 1;
|
|
}
|
|
else if (Convert.ToInt32(numericUpDown16.Value) < dGVStroje.ColumnCount - 1) numericUpDown16.Value += 1;
|
|
hodnotaPredKlikomStroje = Convert.ToInt32(numericUpDown16.Value);
|
|
}
|
|
refreshStroje();
|
|
}
|
|
|
|
Int32 hodnotaPredKlikomStroje2;
|
|
private void numericUpDown15_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (dGVStroje.Columns[Convert.ToInt32(numericUpDown15.Value)].Visible == true)
|
|
{
|
|
if (Convert.ToInt32(numericUpDown15.Value) < dGVStroje.Columns.Count) label24.Text = dGVStroje.Columns[Convert.ToInt32(numericUpDown15.Value)].HeaderText;
|
|
hodnotaPredKlikomStroje2 = Convert.ToInt32(numericUpDown15.Value);
|
|
}
|
|
else
|
|
{
|
|
if (hodnotaPredKlikomStroje2 > Convert.ToInt32(numericUpDown15.Value))
|
|
{
|
|
numericUpDown16.Value -= 1;
|
|
}
|
|
else if (Convert.ToInt32(numericUpDown15.Value) < dGVStroje.ColumnCount - 1) numericUpDown15.Value += 1;
|
|
hodnotaPredKlikomStroje2 = Convert.ToInt32(numericUpDown15.Value);
|
|
}
|
|
refreshStroje();
|
|
}
|
|
|
|
private void button67_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel21.Visible == false) panel21.Visible = true;
|
|
else panel21.Visible = false;
|
|
numericUpDown16.Maximum = dGVStroje.Columns.Count - 1;
|
|
numericUpDown15.Maximum = dGVStroje.Columns.Count - 1;
|
|
label25.Text = dGVStroje.Columns[0].HeaderText;
|
|
label24.Text = dGVStroje.Columns[0].HeaderText;
|
|
}
|
|
|
|
private void dGVStroje_RowEnter(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
string IDstroj = dGVStroje.Rows[e.RowIndex].Cells["IDStroj"].Value.ToString();
|
|
|
|
DataTable dtPU = new DataTable();
|
|
classSQL.SQL("SELECT * FROM tabudrzba WHERE `IDStroja` = " + IDstroj + ";", out dtPU);
|
|
|
|
dGVPU.DataSource = dtPU;
|
|
}
|
|
|
|
private void button78_Click(object sender, EventArgs e)
|
|
{
|
|
DataTable dtPouzitePU = new DataTable();
|
|
classSQL.SQL("SELECT DISTINCT `PeriodaPU`, `MesiacPU`, `PopisPU` FROM tabudrzba ORDER BY IDUdrzba;", out dtPouzitePU);
|
|
dataGridView6.DataSource = dtPouzitePU;
|
|
|
|
panel27.Visible = true;
|
|
dataGridView6.Focus();
|
|
}
|
|
|
|
private void panel27_Leave(object sender, EventArgs e)
|
|
{
|
|
panel27.Visible = false;
|
|
}
|
|
|
|
private void textBox28_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (textBox28.Text == "" || comboBox9.Text == "") button77.Enabled = false;
|
|
else button77.Enabled = true;
|
|
|
|
}
|
|
|
|
private void comboBox9_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (textBox28.Text == "" || comboBox9.Text == "") button77.Enabled = false;
|
|
else button77.Enabled = true;
|
|
|
|
switch (comboBox9.Text)
|
|
{
|
|
case "Týždenne":
|
|
comboBox4.Items.Clear();
|
|
comboBox4.Text = "";
|
|
comboBox4.DropDownWidth = comboBox4.Size.Width;
|
|
comboBox4.Enabled = false;
|
|
break;
|
|
case "Mesačne":
|
|
comboBox4.Items.Clear();
|
|
comboBox4.Text = "";
|
|
comboBox4.DropDownWidth = comboBox4.Size.Width;
|
|
comboBox4.Enabled = false;
|
|
break;
|
|
case "Štvrťročne":
|
|
comboBox4.Items.Clear();
|
|
comboBox4.Text = "";
|
|
comboBox4.Items.Add("01, 04, 07, 10");
|
|
comboBox4.Items.Add("02, 05, 08, 11");
|
|
comboBox4.Items.Add("03, 06, 09, 12");
|
|
comboBox4.DropDownWidth = comboBox4.Size.Width;
|
|
comboBox4.Enabled = true;
|
|
comboBox4.Focus();
|
|
break;
|
|
case "Ročne":
|
|
comboBox4.Items.Clear();
|
|
comboBox4.Text = "";
|
|
for (int i = 1; i < 13; i++) comboBox4.Items.Add(DateTimeFormatInfo.CurrentInfo.GetMonthName(i));
|
|
comboBox4.DropDownWidth = comboBox4.Size.Width;
|
|
comboBox4.Enabled = true;
|
|
comboBox4.Focus();
|
|
break;
|
|
case "5-ročne":
|
|
comboBox4.Items.Clear();
|
|
comboBox4.Text = "";
|
|
for (int i = 0; i < 6; i++) comboBox4.Items.Add("8/" + (DateTime.Today.Year + i).ToString() + ", 8/" + (DateTime.Today.Year + i + 5).ToString() + ", 8/" + (DateTime.Today.Year + i + 10).ToString());
|
|
comboBox4.DropDownWidth = 170;
|
|
comboBox4.Enabled = true;
|
|
comboBox4.Focus();
|
|
break;
|
|
default:
|
|
comboBox4.Items.Clear();
|
|
comboBox4.Text = "";
|
|
comboBox4.Enabled = false;
|
|
break;
|
|
}
|
|
comboBox4.SelectedItem = -1;
|
|
|
|
}
|
|
|
|
private void button77_Click(object sender, EventArgs e)
|
|
{
|
|
string cmd = "";
|
|
string IDStroja = "";
|
|
IDStroja = dGVStroje.Rows[dGVStroje.SelectedRows[0].Index].Cells["IDStroj"].Value.ToString();
|
|
|
|
cmd = @"INSERT INTO `mip`.`tabudrzba` ( `IDstroja`, `PeriodaPU`, `MesiacPU`, `PopisPU`) VALUES ("
|
|
+ IDStroja + ", '"
|
|
+ comboBox9.Text + "', '"
|
|
+ comboBox4.Text + "', '"
|
|
+ textBox28.Text + "')";
|
|
classSQL.SQL(cmd);
|
|
|
|
DataTable dtPU = new DataTable();
|
|
classSQL.SQL("SELECT * FROM tabudrzba WHERE `IDStroja` = " + IDStroja + ";", out dtPU);
|
|
|
|
dGVPU.DataSource = dtPU;
|
|
panelPridatPU.Visible = false;
|
|
}
|
|
|
|
private void dataGridView6_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
dataGridView6.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
|
|
|
dataGridView6.Columns["MesiacPU"].HeaderText = "Mesiac";
|
|
dataGridView6.Columns["MesiacPU"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView6.Columns["PeriodaPU"].HeaderText = "Perióda";
|
|
dataGridView6.Columns["PeriodaPU"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView6.Columns["PopisPU"].HeaderText = "Text plánovanej údržby";
|
|
dataGridView6.Columns["PopisPU"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
|
|
|
dataGridView6.AutoResizeColumns();
|
|
}
|
|
|
|
private void dataGridView6_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
comboBox9.Text = dataGridView6.Rows[e.RowIndex].Cells["PeriodaPU"].Value.ToString();
|
|
comboBox4.Text = dataGridView6.Rows[e.RowIndex].Cells["MesiacPU"].Value.ToString();
|
|
textBox28.Text = dataGridView6.Rows[e.RowIndex].Cells["PopisPU"].Value.ToString();
|
|
panel27.Visible = false;
|
|
}
|
|
|
|
#endregion Zoznam Strojov
|
|
|
|
#region Údržby a opravy
|
|
|
|
private void button72_Click(object sender, EventArgs e)
|
|
{
|
|
if (panelPridatUdrzbu.Visible == false) panelPridatUdrzbu.Visible = true;
|
|
else panelPridatUdrzbu.Visible = false;
|
|
}
|
|
|
|
private void panelPridatUdrzbu_Leave(object sender, EventArgs e)
|
|
{
|
|
comboBox6.DataSource = null;
|
|
comboBox6.Enabled = false;
|
|
comboBox15.Enabled = false;
|
|
label45.Enabled = false;
|
|
panelPridatUdrzbu.Visible = false;
|
|
comboBox5.Enabled = false; button79.Enabled = false; label44.Enabled = false;
|
|
label42.Enabled = false; dateTimePicker5.Enabled = false; numericUpDown22.Enabled = false; numericUpDown21.Enabled = false; label41.Enabled = false; dateTimePicker2.Enabled = false; numericUpDown17.Enabled = false; numericUpDown18.Enabled = false;
|
|
comboBox7.Enabled = false; button81.Enabled = false; label43.Enabled = false;
|
|
label27.Enabled = false;
|
|
label26.Enabled = false;
|
|
label3.Enabled = false;
|
|
textBox21.Enabled = false;
|
|
textBox20.Enabled = false;
|
|
textBox3.Enabled = false;
|
|
button70.Enabled = false;
|
|
}
|
|
|
|
private void comboBox8_SelectedValueChanged(object sender, EventArgs e)
|
|
{
|
|
comboBox6.DataSource = null;
|
|
comboBox6.Items.Clear();
|
|
string cmd = "SELECT CONCAT (`Vyrobca`, ' - ', `ModelStroja`) AS `Stroj`, `IDStroj` FROM `mip`.tabstroje WHERE `Dielna` = '" + comboBox8.Text + "';";
|
|
DataTable tblStroje = new DataTable();
|
|
classSQL.SQL(cmd, out tblStroje);
|
|
comboBox6.DataSource = tblStroje;
|
|
comboBox6.ValueMember = "IDStroj";
|
|
comboBox6.DisplayMember = "Stroj";
|
|
comboBox6.SelectedIndex = -1;
|
|
comboBox6.Enabled = true;
|
|
if (comboBox8.Text == "") comboBox6.Enabled = false;
|
|
label45.Enabled = true;
|
|
}
|
|
|
|
private void comboBox6_SelectedValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (comboBox6.Text != "") { comboBox5.Enabled = true; button79.Enabled = true; label44.Enabled = true; }
|
|
else { comboBox5.Enabled = false; button79.Enabled = false; label44.Enabled = false; }
|
|
|
|
}
|
|
|
|
private void comboBox7_SelectedValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (comboBox7.Text != "")
|
|
{
|
|
label42.Enabled = true;
|
|
dateTimePicker5.Enabled = true;
|
|
numericUpDown22.Enabled = true;
|
|
numericUpDown21.Enabled = true;
|
|
label41.Enabled = true;
|
|
dateTimePicker2.Enabled = true;
|
|
numericUpDown17.Enabled = true;
|
|
numericUpDown18.Enabled = true;
|
|
label27.Enabled = true;
|
|
label26.Enabled = true;
|
|
label3.Enabled = true;
|
|
textBox21.Enabled = true;
|
|
textBox20.Enabled = true;
|
|
textBox3.Enabled = true;
|
|
button70.Enabled = true;
|
|
|
|
}
|
|
else
|
|
{
|
|
label42.Enabled = false;
|
|
dateTimePicker5.Enabled = false;
|
|
numericUpDown22.Enabled = false;
|
|
numericUpDown21.Enabled = false;
|
|
label41.Enabled = false;
|
|
dateTimePicker2.Enabled = false;
|
|
numericUpDown17.Enabled = false;
|
|
numericUpDown18.Enabled = false;
|
|
label27.Enabled = false;
|
|
label26.Enabled = false;
|
|
label3.Enabled = false;
|
|
textBox21.Enabled = false;
|
|
textBox20.Enabled = false;
|
|
textBox3.Enabled = false;
|
|
button70.Enabled = false;
|
|
}
|
|
}
|
|
|
|
private void comboBox5_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (comboBox5.Text != "")
|
|
{
|
|
comboBox7.Enabled = true;
|
|
button81.Enabled = true;
|
|
label43.Enabled = true;
|
|
if (comboBox5.Text == "Plánovaná údržba")
|
|
{
|
|
comboBox15.DataSource = null;
|
|
comboBox15.Items.Clear();
|
|
string cmd = "select `popisPU`, `IDUdrzba` from `tabudrzba` where IDstroja =" + comboBox6.SelectedValue.ToString() + ";";
|
|
DataTable tblPU = new DataTable();
|
|
classSQL.SQL(cmd, out tblPU);
|
|
comboBox15.DataSource = tblPU;
|
|
comboBox15.ValueMember = "IDUdrzba";
|
|
comboBox15.DisplayMember = "popisPU";
|
|
comboBox15.SelectedIndex = -1;
|
|
|
|
comboBox15.Enabled = true;
|
|
label110.Enabled = true;
|
|
}
|
|
else { comboBox15.Enabled = false; label110.Enabled = false; }
|
|
|
|
}
|
|
else { comboBox7.Enabled = false; button81.Enabled = false; label43.Enabled = false; }
|
|
}
|
|
|
|
private void button79_Click(object sender, EventArgs e)
|
|
{
|
|
Form Add = new frmAddPomUdaje();
|
|
Add.Text = "Pridať operáciu";
|
|
DialogResult dr = Add.ShowDialog();
|
|
if (dr == DialogResult.OK)
|
|
{
|
|
classGlobal.FillCB(comboBox5, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať operáciu");
|
|
comboBox5.Text = classGlobal.strNovyPomocnyUdaj;
|
|
}
|
|
}
|
|
|
|
private void button81_Click(object sender, EventArgs e)
|
|
{
|
|
Form Add = new frmAddPomUdaje();
|
|
Add.Text = "Pridať firmu";
|
|
DialogResult dr = Add.ShowDialog();
|
|
if (dr == DialogResult.OK)
|
|
{
|
|
classGlobal.FillCB(comboBox7, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať firmu");
|
|
comboBox7.Text = classGlobal.strNovyPomocnyUdaj;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#endregion Údržby a opravy
|
|
|
|
#region Kategorizácia zmatkovitosti
|
|
|
|
private void tabPage7_Enter(object sender, EventArgs e)
|
|
{
|
|
label48.Text = numericUpDown1.Value.ToString() + "/x";
|
|
|
|
|
|
refreshZmatkovitost();
|
|
}
|
|
|
|
private void refreshZmatkovitost()
|
|
{
|
|
// v pripade pomaleho hladania instr skusit pouzit match-against funkcie sql servera
|
|
// priklad: SELECT mip_zaloha.test.ID FROM mip_zaloha.test WHERE MATCH(test.meno) AGAINST('iore' IN BOOLEAN MODE)
|
|
|
|
int scrollBarHeight = 0;
|
|
if (dataGridView3.Controls.OfType<HScrollBar>().First().Visible == true) scrollBarHeight = dataGridView3.Controls.OfType<HScrollBar>().First().Height;
|
|
int headerHeight = dataGridView3.ColumnHeadersHeight;
|
|
if (headerHeight < 25) headerHeight = 34;
|
|
|
|
classSQL.intPocetNaStranu = Convert.ToInt32(Math.Floor((double)((dataGridView3.Height - headerHeight - scrollBarHeight - 2) / 22)));
|
|
|
|
if (dataGridView3.SelectedRows.Count > 0) classUser.IndexZmatkovitost = Convert.ToInt32(dataGridView3[dataGridView3.Columns["IDCPOBJ"].Index, dataGridView3.SelectedRows[0].Index].Value.ToString());
|
|
else classUser.IndexZmatkovitost = 0;
|
|
|
|
string strTextBoxCondition = ""; string strStatusZaznamu = "";
|
|
|
|
if (radioButton2.Checked == true) strStatusZaznamu = " `StatusZaznamu` = 'Bez záznamu' OR `StatusZaznamu` = 'Chybný záznam' OR `StatusZaznamu` = 'Údaje vyplnené'";
|
|
if (radioButton1.Checked == true) strStatusZaznamu = " `StatusZaznamu` = 'Bez záznamu'";
|
|
if (radioButton3.Checked == true) strStatusZaznamu = " `StatusZaznamu` = 'Chybný záznam'";
|
|
|
|
if (ZmatkovitostColorIndex > 0) strTextBoxCondition = " AND INSTR(`" + dataGridView3.Columns[ZmatkovitostColorIndex].Name + "`, '" + textBox30.Text + "')>0 ";
|
|
|
|
/* //vyhladavanie vo vsetkych stlpcoch instring podla hodnoty v textboxe
|
|
DataTable columns = classSQL.commandSQL("SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'pohladzmatky' AND TABLE_SCHEMA = 'mip'", 1);
|
|
for (int i = 0; i < columns.Rows.Count-1; i++)
|
|
{
|
|
strTextBoxCondition = strTextBoxCondition + " OR INSTR(`" + columns.Rows[i].ItemArray[0].ToString() + "`, '" + textBox30.Text + "')>0 ";
|
|
}
|
|
//MessageBox.Show(strTextBoxCondition);
|
|
*/
|
|
|
|
string sqlCommandZmatky;
|
|
sqlCommandZmatky = @"SELECT * FROM `pohladzmatkovitost` WHERE `StatusDopytu` = 'Odoslaná' AND ("
|
|
+ strStatusZaznamu + ")" // AND (`StatusDopytu` = 'vymyslena'"
|
|
+ strTextBoxCondition +
|
|
" ORDER BY `IDCPOBJ` DESC;";
|
|
|
|
|
|
DataTable outdtbl = new DataTable();
|
|
Int32 StartRecord = (Convert.ToInt32(numericUpDown24.Value) * classSQL.intPocetNaStranu) - classSQL.intPocetNaStranu;
|
|
classSQL.SQL(sqlCommandZmatky, StartRecord, classSQL.intPocetNaStranu, out outdtbl);
|
|
dataGridView3.DataSource = outdtbl;
|
|
Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
label48.Text = numericUpDown24.Value.ToString() + "/" + PocetStran.ToString();
|
|
if (PocetStran < 1) PocetStran = 1;
|
|
numericUpDown24.Maximum = PocetStran;
|
|
|
|
dataGVSetColumnSortMode(dataGridView3, DataGridViewColumnSortMode.NotSortable);
|
|
|
|
dataGridView3.Visible = true;
|
|
|
|
//zapamata si vybrany riadok po refreshi
|
|
//bool boolFoundRow = false; Int32 intFoundRow=-1;
|
|
//foreach (DataGridViewRow row in dataGridView3.Rows) if (Convert.ToInt32(row.Cells["IDCPOBJ"].Value) == classUser.IndexZmatkovitost) { boolFoundRow = true; intFoundRow = row.Index; }
|
|
//if (intFoundRow != -1) dataGridView3.Rows[intFoundRow].Selected = true;
|
|
//else
|
|
|
|
//if (classUser.IndexZmatkovitost < dataGridView3.Rows.Count-1) dataGridView3.Rows[classUser.IndexZmatkovitost].Selected = true;
|
|
//else if (dataGridView3.Rows.Count == 0) dataGridView3.ClearSelection();
|
|
//else dataGridView3.Rows[dataGridView3.Rows.Count-1].Selected = true;
|
|
//dataGridView3.FirstDisplayedScrollingRowIndex = dataGridView3.SelectedRows[0].Index;
|
|
dataGridView3_Paint(null, null);
|
|
lblZobrazenyPocet.Text = classSQL.intCelkovyPocetZazanmov.ToString(); // +"(" + dataGridView3.DisplayedRowCount(true) + ")";
|
|
}
|
|
|
|
int ZmatkovitostColorIndex = -1;
|
|
private void dataGridView3_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
if (ZmatkovitostColorIndex != e.ColumnIndex && ZmatkovitostColorIndex != -1) dataGridView3.Columns[ZmatkovitostColorIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
|
|
if (dataGridView3.Columns[e.ColumnIndex].DefaultCellStyle.BackColor == Color.Empty)
|
|
{
|
|
dataGridView3.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.GreenYellow;
|
|
ZmatkovitostColorIndex = e.ColumnIndex;
|
|
textBox30.Text = "";
|
|
textBox30.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
dataGridView3.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
ZmatkovitostColorIndex = -1;
|
|
textBox30.Text = "";
|
|
textBox30.Enabled = false;
|
|
}
|
|
|
|
}
|
|
|
|
private void panel24_Click(object sender, EventArgs e)
|
|
{
|
|
textBox30.Text = "";
|
|
textBox30.Enabled = false;
|
|
radioButton2.Checked = true;
|
|
if (ZmatkovitostColorIndex != -1) dataGridView3.Columns[ZmatkovitostColorIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
}
|
|
|
|
private void radioButton2_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZmatkovitost();
|
|
}
|
|
|
|
private void radioButton1_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZmatkovitost();
|
|
}
|
|
|
|
private void radioButton3_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZmatkovitost();
|
|
}
|
|
|
|
private void textBox30_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZmatkovitost();
|
|
}
|
|
|
|
private void numericUpDown24_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZmatkovitost();
|
|
}
|
|
|
|
private void dataGridView3_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
classUser.IndexZmatkovitost = e.RowIndex;
|
|
}
|
|
|
|
bool boolUp;
|
|
bool boolDown;
|
|
private void dataGridView3_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
//Int32 PocetStran = classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu;
|
|
Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
if (e.KeyCode == Keys.Down && dataGridView3.CurrentRow.Index == classSQL.intPocetNaStranu - 1 && numericUpDown24.Value < PocetStran)
|
|
{
|
|
numericUpDown24.Value++;
|
|
dataGridView3.CurrentCell = dataGridView3.FirstDisplayedCell;
|
|
boolUp = true;
|
|
}
|
|
if (e.KeyCode == Keys.Up && dataGridView3.CurrentRow.Index == 0 && numericUpDown24.Value > 1)
|
|
{
|
|
numericUpDown24.Value--;
|
|
dataGridView3.CurrentCell = dataGridView3[1, classSQL.intPocetNaStranu - 1];
|
|
boolDown = true;
|
|
}
|
|
if (e.KeyCode == Keys.PageDown && numericUpDown24.Value < PocetStran) numericUpDown24.Value++;
|
|
if (e.KeyCode == Keys.PageUp && numericUpDown24.Value > 1) numericUpDown24.Value--;
|
|
}
|
|
|
|
private void dataGridView3_SelectionChanged(object sender, EventArgs e)
|
|
{
|
|
//if (dataGridView3.Rows.Count != 0) label4.Text = dataGridView3.CurrentRow.Index.ToString();
|
|
if (boolUp == true)
|
|
{
|
|
SendKeys.Send("{UP}");
|
|
boolUp = false;
|
|
}
|
|
if (boolDown == true)
|
|
{
|
|
SendKeys.Send("{DOWN}");
|
|
boolDown = false;
|
|
}
|
|
}
|
|
|
|
private void dataGridView3_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
dataGridView3.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView3.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView3.Columns["StatusDopytu"].HeaderText = "Status dopytu";
|
|
dataGridView3.Columns["StatusDopytu"].Visible = false;
|
|
dataGridView3.Columns["PocetZmatkov"].HeaderText = "Počet zmätkov";
|
|
dataGridView3.Columns["DatumZaznamu"].HeaderText = "Dátum záznamu";
|
|
dataGridView3.Columns["StatusZaznamu"].HeaderText = "Status záznamu";
|
|
dataGridView3.Columns["Impregnacia"].HeaderText = "Impregnácia";
|
|
dataGridView3.Columns["KontrolaLapovanie"].HeaderText = "Kontrola a lapovanie";
|
|
dataGridView3.Columns["ChybyMaterialu"].HeaderText = "Chyby materiálu";
|
|
|
|
dataGridView3.Columns["IDZmatky"].Visible = false;
|
|
dataGridView3.Columns["IDCPOBJ"].Visible = false;
|
|
dataGridView3.Columns["IDVyrobok"].Visible = false;
|
|
|
|
|
|
//nastavenie velkosti stlpcov
|
|
dataGridView3.Columns["Zákazkové číslo"].Width = 62;
|
|
dataGridView3.Columns["Názov výrobku"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView3.Columns["Spojené rozmery"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView3.Columns["Materiál"].MinimumWidth = 60;
|
|
dataGridView3.Columns["Materiál"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView3.Columns["Úprava materiálu"].MinimumWidth = 60;
|
|
dataGridView3.Columns["Úprava materiálu"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView3.Columns["Zákazník"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView3.Columns["Objednaný počet kusov"].Width = 60;
|
|
dataGridView3.Columns["Počet kusov do výroby"].Width = 60;
|
|
dataGridView3.Columns["Počet vydaných kusov"].Width = 60;
|
|
dataGridView3.Columns["Počet vyrobených dobrých kusov"].Width = 64;
|
|
dataGridView3.Columns["PocetZmatkov"].Width = 60;
|
|
dataGridView3.Columns["Počet odoslaných kusov"].Width = 64;
|
|
dataGridView3.Columns["Počet kusov na sklad"].Width = 60;
|
|
dataGridView3.Columns["DatumZaznamu"].Width = 70;
|
|
dataGridView3.Columns["StatusZaznamu"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView3.Columns["Rezanie"].Width = 70;
|
|
dataGridView3.Columns["Klasika"].Width = 70;
|
|
dataGridView3.Columns["Impregnacia"].Width = 70;
|
|
dataGridView3.Columns["CNC"].Width = 70;
|
|
dataGridView3.Columns["KontrolaLapovanie"].Width = 70;
|
|
dataGridView3.Columns["ChybyMaterialu"].Width = 70;
|
|
|
|
if (button80.Text == "Zobrazenie (min)")
|
|
{
|
|
dataGridView3.Columns["Názov výrobku"].Visible = true;
|
|
dataGridView3.Columns["Spojené rozmery"].Visible = true;
|
|
dataGridView3.Columns["Zákazník"].Visible = true;
|
|
dataGridView3.Columns["Objednaný počet kusov"].Visible = true;
|
|
dataGridView3.Columns["Počet kusov do výroby"].Visible = true;
|
|
dataGridView3.Columns["Počet vydaných kusov"].Visible = true;
|
|
dataGridView3.Columns["Počet vyrobených dobrých kusov"].Visible = true;
|
|
dataGridView3.Columns["Počet odoslaných kusov"].Visible = true;
|
|
dataGridView3.Columns["Počet kusov na sklad"].Visible = true;
|
|
dataGridView3.Columns["DatumZaznamu"].Visible = true;
|
|
dataGridView3.Columns["StatusZaznamu"].Visible = true;
|
|
}
|
|
else
|
|
{
|
|
dataGridView3.Columns["Názov výrobku"].Visible = false;
|
|
dataGridView3.Columns["Spojené rozmery"].Visible = false;
|
|
dataGridView3.Columns["Zákazník"].Visible = false;
|
|
dataGridView3.Columns["Objednaný počet kusov"].Visible = false;
|
|
dataGridView3.Columns["Počet kusov do výroby"].Visible = false;
|
|
dataGridView3.Columns["Počet vydaných kusov"].Visible = false;
|
|
dataGridView3.Columns["Počet vyrobených dobrých kusov"].Visible = false;
|
|
dataGridView3.Columns["Počet odoslaných kusov"].Visible = false;
|
|
dataGridView3.Columns["Počet kusov na sklad"].Visible = false;
|
|
dataGridView3.Columns["DatumZaznamu"].Visible = false;
|
|
dataGridView3.Columns["StatusZaznamu"].Visible = false;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void button80_Click(object sender, EventArgs e)
|
|
{
|
|
if (button80.Text == "Zobrazenie (min)") button80.Text = "Zobrazenie (max)";
|
|
else button80.Text = "Zobrazenie (min)";
|
|
dataGridView3_Paint(null, null);
|
|
}
|
|
|
|
|
|
#endregion Kategorizácia zmatkovitosti
|
|
|
|
private void button83_Click(object sender, EventArgs e)
|
|
{
|
|
if (dGVExpedicia.CurrentRow.Cells["StatusDopytu"].Value.ToString() == "Odoslaná"
|
|
&& (dGVExpedicia.CurrentRow.Cells["Typ Dopytu"].Value.ToString() == "Objednávka"
|
|
|| dGVExpedicia.CurrentRow.Cells["Typ Dopytu"].Value.ToString() == "Objednávka do kontraktu"))
|
|
{
|
|
string strStatus = "Čiastočne odoslaná";
|
|
|
|
string cmdStatusUpdate = "UPDATE `mip`.`tabdopyt` SET `StatusDopytu` = '" + strStatus + "' WHERE `IDCPOBJ`= " + dGVExpedicia.CurrentRow.Cells["IDCPOBJ"].Value.ToString() + ";";
|
|
classSQL.SQL(cmdStatusUpdate);
|
|
MessageBox.Show("Status zmenený na: 'Čiastočne odoslaná' !");
|
|
}
|
|
else MessageBox.Show("Status nie je možné zmeniť!");
|
|
|
|
refreshExpedicia();
|
|
//dataGridView1.Rows[classUser.IndexDopyt].Selected = true;
|
|
|
|
}
|
|
|
|
private void button84_Click(object sender, EventArgs e)
|
|
{
|
|
string strZak = dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells["Zakaznik"].Value.ToString();
|
|
string strVyr = dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells["IDVyrobok"].Value.ToString();
|
|
|
|
Form zobrazVykres = new frmShowVykres(strZak, Convert.ToInt32(strVyr));
|
|
zobrazVykres.Show();
|
|
}
|
|
|
|
private void button86_Click(object sender, EventArgs e)
|
|
{
|
|
string strZak = dGVRV.Rows[dGVRV.SelectedRows[0].Index].Cells["Zakaznik"].Value.ToString();
|
|
string strIDVyr = dGVRV.Rows[dGVRV.SelectedRows[0].Index].Cells["IDVyrobok"].Value.ToString();
|
|
|
|
Form zobrazVykres = new frmShowVykres(strZak, Convert.ToInt32(strIDVyr));
|
|
zobrazVykres.Show();
|
|
}
|
|
|
|
private void button89_Click(object sender, EventArgs e)
|
|
{
|
|
string strZak = dGVExpedicia.Rows[dGVExpedicia.SelectedRows[0].Index].Cells["Zákazník"].Value.ToString();
|
|
string strVyr = dGVExpedicia.Rows[dGVExpedicia.SelectedRows[0].Index].Cells["IDVyrobok"].Value.ToString();
|
|
|
|
Form zobrazVykres = new frmShowVykres(strZak, Convert.ToInt32(strVyr));
|
|
zobrazVykres.Show();
|
|
}
|
|
|
|
private void button90_Click(object sender, EventArgs e)
|
|
{
|
|
string strZak = dataGridView3.Rows[dataGridView3.SelectedRows[0].Index].Cells["Zákazník"].Value.ToString();
|
|
string strIDVyr = dataGridView3.Rows[dataGridView3.SelectedRows[0].Index].Cells["IDVyrobok"].Value.ToString();
|
|
|
|
Form zobrazVykres = new frmShowVykres(strZak, Convert.ToInt32(strIDVyr));
|
|
zobrazVykres.Show();
|
|
}
|
|
|
|
private void btnUpdate_Click(object sender, EventArgs e)
|
|
{
|
|
if (btnUpdate.Enabled == true)
|
|
{
|
|
classGlobal.DeleteRamDisk(); classGlobal.CreateRamDisk();
|
|
classSQL.ExportFormToHDD("MIP-install.exe", @"W:\MIP-install.exe");
|
|
|
|
Process.Start("W:\\MIP-install.exe");
|
|
//classGlobal.DeleteRamDisk();
|
|
Application.Exit();
|
|
}
|
|
|
|
}
|
|
|
|
private void dGVZoznamVyrobkov_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
classUser.IndexVyrobok = e.RowIndex;
|
|
}
|
|
|
|
private void dateTimePicker2_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (dateTimePicker2.Value < dateTimePicker5.Value) dateTimePicker2.Value = dateTimePicker5.Value;
|
|
}
|
|
|
|
private void dateTimePicker5_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (dateTimePicker2.Value < dateTimePicker5.Value) dateTimePicker2.Value = dateTimePicker5.Value;
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void tabPage14_Enter(object sender, EventArgs e)
|
|
{
|
|
// Initialize map:
|
|
|
|
gMapControl1.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance;
|
|
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly;
|
|
gMapControl1.DragButton = MouseButtons.Left;
|
|
|
|
gMapControl1.Position = new PointLatLng(48.554190, 18.162420);
|
|
|
|
gMapControl1.Zoom = trackBar1.Value;
|
|
|
|
RefreshFirmy();
|
|
|
|
}
|
|
|
|
void RefreshFirmy()
|
|
{
|
|
string cmd = "select `FirmaMeno` as `Názovfirmy`, IDFirma as `IDFirma` from `tabfirmy`";
|
|
DataTable tabfirmy = new DataTable();
|
|
classSQL.SQL(cmd, out tabfirmy);
|
|
dataGridView11.DataSource = tabfirmy;
|
|
dataGridView11.Columns["IDFirma"].Visible = false;
|
|
dataGridView11.Columns["Názovfirmy"].Width = 220;
|
|
}
|
|
|
|
private void gMapControl1_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
trackBar1.Value = Convert.ToInt32(gMapControl1.Zoom);
|
|
}
|
|
|
|
private void trackBar1_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
gMapControl1.Zoom = trackBar1.Value;
|
|
|
|
}
|
|
|
|
private void gMapControl1_OnMarkerClick(object sender, MouseEventArgs e)
|
|
{
|
|
Panel info = new Panel();
|
|
info.Location = new Point(100, 100);
|
|
info.Size = new Size(200, 200);
|
|
info.BackColor = Color.Red;
|
|
info.Visible = true;
|
|
|
|
gMapControl1.Controls.Add(info);
|
|
info.BringToFront();
|
|
|
|
MessageBox.Show(this.Location.X.ToString() + ":" + this.Location.Y.ToString());
|
|
}
|
|
|
|
private void textBox31_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
public GMapProvider MapProvider;
|
|
private void button2_Click_1(object sender, EventArgs e)
|
|
{
|
|
|
|
classMapa.SearchGoogleAPI(textBox31.Text, "address=");
|
|
gMapControl1.Position = new PointLatLng(classMapa.zemSirka, classMapa.zemDlzka);
|
|
//gMapControl1.ViewArea.LocationTopLeft.Lat = Convert.ToDouble(ndgv.Rows[ndgv.CurrentCell.RowIndex].Cells["ViewSV-šírka"].Value.ToString());
|
|
ndgv.DataSource = classMapa.dataTable;
|
|
ndgv.AutoResizeColumns();
|
|
RectLatLng view = new RectLatLng(Convert.ToDouble(ndgv.Rows[ndgv.CurrentCell.RowIndex].Cells["ViewJZ-šírka"].Value.ToString()),
|
|
Convert.ToDouble(ndgv.Rows[ndgv.CurrentCell.RowIndex].Cells["ViewJZ-dížka"].Value.ToString()),
|
|
Convert.ToDouble(ndgv.Rows[ndgv.CurrentCell.RowIndex].Cells["ViewSV-šírka"].Value.ToString()) - Convert.ToDouble(ndgv.Rows[ndgv.CurrentCell.RowIndex].Cells["ViewJZ-šírka"].Value.ToString()),
|
|
Convert.ToDouble(ndgv.Rows[ndgv.CurrentCell.RowIndex].Cells["ViewSV-dížka"].Value.ToString()) - Convert.ToDouble(ndgv.Rows[ndgv.CurrentCell.RowIndex].Cells["ViewJZ-dížka"].Value.ToString()));
|
|
gMapControl1.SetZoomToFitRect(view);
|
|
|
|
ndgv.Columns["Číslo"].Visible = false;
|
|
ndgv.Columns["Ulica"].Visible = false;
|
|
ndgv.Columns["Názov"].Visible = false;
|
|
ndgv.Columns["Č.D."].Visible = false;
|
|
ndgv.Columns["PSČ"].Visible = false;
|
|
ndgv.Columns["Krajina"].Visible = false;
|
|
ndgv.Columns["Šírka"].Visible = false;
|
|
ndgv.Columns["Dĺžka"].Visible = false;
|
|
ndgv.Columns["ViewSV-šírka"].Visible = false;
|
|
ndgv.Columns["ViewSV-dížka"].Visible = false;
|
|
ndgv.Columns["ViewJZ-šírka"].Visible = false;
|
|
ndgv.Columns["ViewJZ-dížka"].Visible = false;
|
|
|
|
/*
|
|
GeocodingProvider gp = MapProvider as GeocodingProvider;
|
|
GeoCoderStatusCode status = GeoCoderStatusCode.Unknow;
|
|
Placemark plm = new Placemark();
|
|
|
|
|
|
if (gp == null)
|
|
{
|
|
gp = GMapProviders.OpenStreetMap as GeocodingProvider;
|
|
}
|
|
|
|
PointLatLng hladat = new PointLatLng();
|
|
if (gp != null)
|
|
{
|
|
plm.LocalityName = textBox31.Text;
|
|
var pt = gp.GetPoint(plm.LocalityName.ToString(), out status);
|
|
if (status == GeoCoderStatusCode.G_GEO_SUCCESS && pt.HasValue)
|
|
{
|
|
MessageBox.Show(pt.Value.ToString());
|
|
hladat = pt.Value;
|
|
}
|
|
}
|
|
gMapControl1.Position = new PointLatLng(hladat.Lat, hladat.Lng);
|
|
//GMapOverlay markersOverlay = new GMapOverlay("markers");
|
|
//GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(48.554190, 18.162420), GMarkerGoogleType.pink);
|
|
//markersOverlay.Markers.Add(marker);
|
|
*/
|
|
/*for (int i = 1; i < 151; i++)
|
|
{
|
|
marker = new GMarkerGoogle(new PointLatLng(55, i),GMarkerGoogleType.red);
|
|
markersOverlay.Markers.Add(marker);
|
|
}
|
|
|
|
//gMapControl1.Overlays.Add(markersOverlay);
|
|
//this.gMapControl1.OnMarkerClick += new GMap.NET.WindowsForms.MarkerClick(this.gMapControl1_OnMarkerClick);
|
|
//gMapControl1.ReloadMap();
|
|
|
|
*/
|
|
}
|
|
|
|
private void panel30_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel28.Size.Height == 25)
|
|
{
|
|
panel28.Size = new Size(panel28.Size.Width, flowLayoutPanel1.Size.Height - 112);
|
|
panel29.Size = new Size(panel28.Size.Width, 25);
|
|
panel31.Size = new Size(panel28.Size.Width, 25);
|
|
panel32.Size = new Size(panel28.Size.Width, 25);
|
|
panel33.Size = new Size(panel28.Size.Width, 25);
|
|
}
|
|
else panel28.Size = new Size(panel28.Size.Width, 25);
|
|
}
|
|
|
|
private void panel35_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel29.Size.Height == 25)
|
|
{
|
|
panel29.Size = new Size(panel29.Size.Width, flowLayoutPanel1.Size.Height - 112);
|
|
panel28.Size = new Size(panel28.Size.Width, 25);
|
|
panel31.Size = new Size(panel28.Size.Width, 25);
|
|
panel32.Size = new Size(panel28.Size.Width, 25);
|
|
panel33.Size = new Size(panel28.Size.Width, 25);
|
|
}
|
|
else panel29.Size = new Size(panel29.Size.Width, 25);
|
|
}
|
|
|
|
private void panel36_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel31.Size.Height == 25)
|
|
{
|
|
panel31.Size = new Size(panel31.Size.Width, flowLayoutPanel1.Size.Height - 112);
|
|
panel28.Size = new Size(panel28.Size.Width, 25);
|
|
panel29.Size = new Size(panel28.Size.Width, 25);
|
|
panel32.Size = new Size(panel28.Size.Width, 25);
|
|
panel33.Size = new Size(panel28.Size.Width, 25);
|
|
}
|
|
else panel31.Size = new Size(panel31.Size.Width, 25);
|
|
}
|
|
|
|
private void panel37_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel32.Size.Height == 25)
|
|
{
|
|
panel32.Size = new Size(panel32.Size.Width, flowLayoutPanel1.Size.Height - 112);
|
|
panel28.Size = new Size(panel28.Size.Width, 25);
|
|
panel29.Size = new Size(panel28.Size.Width, 25);
|
|
panel31.Size = new Size(panel28.Size.Width, 25);
|
|
panel33.Size = new Size(panel28.Size.Width, 25);
|
|
}
|
|
else panel32.Size = new Size(panel32.Size.Width, 25);
|
|
}
|
|
|
|
private void panel38_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel33.Size.Height == 25)
|
|
{
|
|
panel33.Size = new Size(panel33.Size.Width, flowLayoutPanel1.Size.Height - 112);
|
|
panel28.Size = new Size(panel28.Size.Width, 25);
|
|
panel29.Size = new Size(panel28.Size.Width, 25);
|
|
panel31.Size = new Size(panel28.Size.Width, 25);
|
|
panel32.Size = new Size(panel28.Size.Width, 25);
|
|
}
|
|
else panel33.Size = new Size(panel33.Size.Width, 25);
|
|
}
|
|
|
|
private void panel30_LocationChanged(object sender, EventArgs e)
|
|
{
|
|
if (panel30.Location.Y == 1) panel30.BackgroundImage = Properties.Resources.down;
|
|
else panel30.BackgroundImage = Properties.Resources.up;
|
|
}
|
|
|
|
private void panel35_LocationChanged(object sender, EventArgs e)
|
|
{
|
|
if (panel35.Location.Y == 1) panel35.BackgroundImage = Properties.Resources.down;
|
|
else panel35.BackgroundImage = Properties.Resources.up;
|
|
}
|
|
|
|
private void panel30_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void panel39_Click(object sender, EventArgs e)
|
|
{
|
|
Form frmPridatFirmu = new frmAddFirma();
|
|
frmPridatFirmu.Location = new Point(trackBar1.Location.X + 20, trackBar1.Location.Y + 116);
|
|
frmPridatFirmu.ShowDialog();
|
|
RefreshFirmy();
|
|
//if (panel42.Visible == false) panel42.Visible = true;
|
|
//else panel42.Visible = false;
|
|
}
|
|
|
|
private void panel42_Leave(object sender, EventArgs e)
|
|
{
|
|
//panel42.Visible = false;
|
|
}
|
|
|
|
private void button91_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
classMapa.SearchGoogleAPI(gMapControl1.Position.Lat.ToString().Replace(",", ".") + "," + gMapControl1.Position.Lng.ToString().Replace(",", "."), "latlng=");
|
|
//https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true_or_false&key=API_KEY
|
|
|
|
ndgv.DataSource = classMapa.dataTable;
|
|
ndgv.AutoResizeColumns();
|
|
|
|
ndgv.Columns["Číslo"].Visible = false;
|
|
ndgv.Columns["Ulica"].Visible = false;
|
|
ndgv.Columns["Názov"].Visible = false;
|
|
ndgv.Columns["Č.D."].Visible = false;
|
|
ndgv.Columns["PSČ"].Visible = false;
|
|
ndgv.Columns["Krajina"].Visible = false;
|
|
ndgv.Columns["Šírka"].Visible = false;
|
|
ndgv.Columns["Dĺžka"].Visible = false;
|
|
ndgv.Columns["ViewSV-šírka"].Visible = false;
|
|
ndgv.Columns["ViewSV-dížka"].Visible = false;
|
|
ndgv.Columns["ViewJZ-šírka"].Visible = false;
|
|
ndgv.Columns["ViewJZ-dížka"].Visible = false;
|
|
|
|
gMapControl1.Position = new PointLatLng(Convert.ToDouble(ndgv.Rows[ndgv.CurrentCell.RowIndex].Cells["Šírka"].Value.ToString()), Convert.ToDouble(ndgv.Rows[ndgv.CurrentCell.RowIndex].Cells["Dĺžka"].Value.ToString()));
|
|
}
|
|
|
|
private void ndgv_Click(object sender, EventArgs e)
|
|
{
|
|
if (ndgv.Rows.Count != 0)
|
|
{
|
|
double šírka = Convert.ToDouble(ndgv.Rows[ndgv.SelectedRows[0].Index].Cells["Šírka"].Value.ToString());
|
|
double dĺžka = Convert.ToDouble(ndgv.Rows[ndgv.SelectedRows[0].Index].Cells["Dĺžka"].Value.ToString());
|
|
double ViewJZšírka = Convert.ToDouble(ndgv.Rows[ndgv.SelectedRows[0].Index].Cells["ViewJZ-šírka"].Value.ToString());
|
|
double ViewJZdĺžka = Convert.ToDouble(ndgv.Rows[ndgv.SelectedRows[0].Index].Cells["ViewJZ-dížka"].Value.ToString());
|
|
double ViewSVšírka = Convert.ToDouble(ndgv.Rows[ndgv.SelectedRows[0].Index].Cells["ViewSV-šírka"].Value.ToString());
|
|
double ViewSVdĺžka = Convert.ToDouble(ndgv.Rows[ndgv.SelectedRows[0].Index].Cells["ViewSV-dížka"].Value.ToString());
|
|
|
|
gMapControl1.Overlays.Clear();
|
|
|
|
GMapOverlay polyOverlay = new GMapOverlay("polygons");
|
|
List<PointLatLng> points = new List<PointLatLng>();
|
|
points.Add(new PointLatLng(ViewJZšírka, ViewJZdĺžka));
|
|
points.Add(new PointLatLng(ViewJZšírka, ViewSVdĺžka));
|
|
points.Add(new PointLatLng(ViewSVšírka, ViewSVdĺžka));
|
|
points.Add(new PointLatLng(ViewSVšírka, ViewJZdĺžka));
|
|
GMapPolygon polygon = new GMapPolygon(points, "mypolygon");
|
|
polygon.Fill = new SolidBrush(Color.FromArgb(50, Color.LightBlue));
|
|
polygon.Stroke = new Pen(Color.Red, 1);
|
|
polyOverlay.Polygons.Add(polygon);
|
|
gMapControl1.Overlays.Add(polyOverlay);
|
|
|
|
RectLatLng view = new RectLatLng(šírka, dĺžka, ViewSVšírka - ViewJZšírka, ViewSVdĺžka - ViewJZdĺžka);
|
|
gMapControl1.SetZoomToFitRect(view);
|
|
//gMapControl1.Position = new PointLatLng(šírka,dĺžka);
|
|
gMapControl1.Position = new PointLatLng((ViewJZšírka + ViewSVšírka) / 2, (ViewJZdĺžka + ViewSVdĺžka) / 2);
|
|
|
|
//MessageBox.Show(šírka.ToString() + ":" + dĺžka.ToString() + "\n" + gMapControl1.Position.Lat.ToString() + ":" + gMapControl1.Position.Lng.ToString());
|
|
}
|
|
}
|
|
|
|
private void setPanelColor(Panel pnl, Label lbl)
|
|
{
|
|
if (pnl.Size.Height == 25)
|
|
{
|
|
pnl.BackColor = Color.Transparent;
|
|
lbl.BackColor = Color.Transparent;
|
|
lbl.Font = new Font(Font.Name, 8.25F, FontStyle.Regular);
|
|
}
|
|
else
|
|
{
|
|
pnl.BackColor = Color.LightYellow;
|
|
lbl.BackColor = Color.Gold;
|
|
lbl.Font = new Font(Font.Name, 12.0F, FontStyle.Bold);
|
|
}
|
|
}
|
|
|
|
private void panel29_Resize(object sender, EventArgs e)
|
|
{
|
|
setPanelColor(panel29, label54);
|
|
ndgv.Location = new Point(1, 91);
|
|
ndgv.Size = new Size(ndgv.Size.Width, panel29.Size.Height - ndgv.Location.Y - 3);
|
|
}
|
|
|
|
private void panel33_Resize(object sender, EventArgs e)
|
|
{
|
|
setPanelColor(panel33, label57);
|
|
}
|
|
|
|
private void panel32_Resize(object sender, EventArgs e)
|
|
{
|
|
setPanelColor(panel32, label56);
|
|
}
|
|
|
|
private void panel31_Resize(object sender, EventArgs e)
|
|
{
|
|
setPanelColor(panel31, label55);
|
|
}
|
|
|
|
private void panel28_Resize(object sender, EventArgs e)
|
|
{
|
|
setPanelColor(panel28, label53);
|
|
dataGridView1.Location = new Point(1, 46);
|
|
dataGridView1.Size = new Size(dataGridView1.Size.Width, panel28.Size.Height - dataGridView1.Location.Y - 3);
|
|
}
|
|
|
|
// upravoit velkost fontu aby sedel do velkosti labelu
|
|
// zatial nepouzite
|
|
public static float BestFontSize(Graphics g, Size z, Font f, string s)
|
|
{
|
|
SizeF p = g.MeasureString(s, f);
|
|
float hRatio = z.Height / p.Height;
|
|
float wRatio = z.Width / p.Width;
|
|
float ratio = Math.Min(hRatio, wRatio);
|
|
return f.Size * ratio;
|
|
}
|
|
|
|
private void dataGridView3_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
Int32 intID = Convert.ToInt32(dataGridView3[dataGridView3.Columns["IDCPOBJ"].Index, e.RowIndex].Value.ToString());
|
|
frmZadatZmatkovitost frmZadatZmatkovitost2 = new frmZadatZmatkovitost(intID);
|
|
frmZadatZmatkovitost2.ShowDialog();
|
|
refreshZmatkovitost();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region Spoločné funkcie
|
|
|
|
private void setDGV(DataGridView _setdgv, Int32 _Index, TextBox _tb)
|
|
{
|
|
_setdgv.Visible = true;
|
|
lblZobrazenyPocet.Text = classSQL.intCelkovyPocetZazanmov.ToString();
|
|
|
|
if (_setdgv.Rows.Count != 0)
|
|
if (_tb.Enabled == true) _tb.Focus();
|
|
else
|
|
{
|
|
_setdgv.ClearSelection();
|
|
if (_Index < _setdgv.Rows.Count - 1 && _Index > 0) _setdgv.Rows[_Index].Selected = true;
|
|
else if (_setdgv.Rows.Count != 0) _setdgv.Rows[_setdgv.Rows.Count - 1].Selected = true;//_setdgv.Rows[_setdgv.Rows.Count - 1].Selected = true; //
|
|
else _setdgv.Rows[0].Selected = true;
|
|
//if (_setdgv.Rows.Count != 0) _setdgv.FirstDisplayedScrollingRowIndex = _setdgv.SelectedRows[0].Index;
|
|
_setdgv.Focus();
|
|
_setdgv.Select();
|
|
}
|
|
|
|
}
|
|
|
|
private void setDGV(DataGridView _setdgv, Int32 _Index)
|
|
{
|
|
if (_setdgv.Rows.Count > 0)
|
|
{
|
|
_setdgv.ClearSelection();
|
|
_setdgv.Rows[_Index].Selected = true;
|
|
}
|
|
_setdgv.Visible = true;
|
|
lblZobrazenyPocet.Text = classSQL.intCelkovyPocetZazanmov.ToString();
|
|
}
|
|
|
|
public static void dataGVSetColumnSortMode(DataGridView dGV, DataGridViewColumnSortMode sortMode)
|
|
{
|
|
for (int i = 0; i < dGV.Columns.Count; i++) dGV.Columns[i].SortMode = sortMode;
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion Spoločné funkcie
|
|
|
|
#region Výkresy
|
|
|
|
private void tabPage16_Enter(object sender, EventArgs e)
|
|
{
|
|
refreshVykres();
|
|
}
|
|
|
|
private void refreshVykres()
|
|
{
|
|
|
|
int scrollBarHeight = 0;
|
|
if (dataGridView12.Controls.OfType<HScrollBar>().First().Visible == true) scrollBarHeight = dataGridView12.Controls.OfType<HScrollBar>().First().Height;
|
|
int headerHeight = dataGridView12.ColumnHeadersHeight;
|
|
if (headerHeight < 25) headerHeight = 47;
|
|
|
|
classSQL.intPocetNaStranu = Convert.ToInt32(Math.Floor((double)((dataGridView12.Height - headerHeight - scrollBarHeight - 2) / 22)));
|
|
|
|
string strTextBoxConditionNazov = " INSTR(`NazovVyrobku`, '" + textBox5.Text + "')>0 ";
|
|
string strTextBoxConditionZakaznik = " AND INSTR(`Zakaznik`, '" + textBox14.Text + "')>0 ";
|
|
string strTextBoxConditionRozmery = " AND INSTR(`SpojeneRozmery`, '" + textBox16.Text + "')>0 ";
|
|
|
|
string sqlCommandVydajMat =
|
|
$@"SELECT
|
|
v.*,
|
|
CONCAT(p.RozmerTvar, p.Rozmer1, if (p.RozmerTvar = 'Ø', '/', 'x'), p.Rozmer2, 'x', p.Rozmer3, ' (', p.PocetKusovVPolotovare, '-Ks)') AS 'RozmerPolotovaru'
|
|
FROM `tabvyrobok` v
|
|
LEFT JOIN tabpolotovar p ON p.IDVyrobok = v.IDVyrobok
|
|
WHERE {strTextBoxConditionNazov} {strTextBoxConditionZakaznik} {strTextBoxConditionRozmery};";
|
|
|
|
|
|
//WHERE INSTR(v.NazovVyrobku, '')> 0 AND INSTR(v.Zakaznik, '')> 0 AND INSTR(v.SpojeneRozmery, '')> 0;
|
|
|
|
DataTable dtbVykres = new DataTable();
|
|
Int32 StartRecord = (Convert.ToInt32(numericUpDown2.Value) * classSQL.intPocetNaStranu) - classSQL.intPocetNaStranu;
|
|
|
|
classSQL.SQL(sqlCommandVydajMat, StartRecord, classSQL.intPocetNaStranu, out dtbVykres);
|
|
dataGridView12.DataSource = dtbVykres;
|
|
|
|
Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
label59.Text = "Strana: " + numericUpDown2.Value.ToString() + "/" + PocetStran.ToString();
|
|
if (PocetStran < 1) PocetStran = 1;
|
|
numericUpDown2.Maximum = PocetStran;
|
|
|
|
dataGVSetColumnSortMode(dataGridView12, DataGridViewColumnSortMode.NotSortable);
|
|
setDGV(dataGridView12, 0);
|
|
|
|
}
|
|
|
|
private void textBox5_TextChanged_1(object sender, EventArgs e)
|
|
{
|
|
refreshVykres();
|
|
}
|
|
|
|
private void textBox14_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshVykres();
|
|
}
|
|
|
|
private void textBox16_TextChanged_1(object sender, EventArgs e)
|
|
{
|
|
refreshVykres();
|
|
}
|
|
|
|
private void dataGridView12_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
string strZak = dataGridView12.Rows[e.RowIndex].Cells["Zakaznik"].Value.ToString();
|
|
string strIDVyr = dataGridView12.Rows[e.RowIndex].Cells["IDVyrobok"].Value.ToString();
|
|
|
|
Form zobrazVykres = new frmShowVykres(strZak, Convert.ToInt32(strIDVyr));
|
|
zobrazVykres.Show();
|
|
}
|
|
|
|
private void numericUpDown2_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
refreshVykres();
|
|
}
|
|
|
|
private void dataGridView12_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
|
|
dataGridView12.Columns["NazovVyrobku"].HeaderText = "Názov výrobku";
|
|
dataGridView12.Columns["NazovVyrobku"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView12.Columns["RozmerTvar"].HeaderText = "Tvar výrobku";
|
|
dataGridView12.Columns["RozmerTvar"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView12.Columns["Rozmer1"].HeaderText = "1. rozmer";
|
|
dataGridView12.Columns["Rozmer1"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView12.Columns["Rozmer2"].HeaderText = "2. rozmer";
|
|
dataGridView12.Columns["Rozmer2"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView12.Columns["Rozmer3"].HeaderText = "3. rozmer";
|
|
dataGridView12.Columns["Rozmer3"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView12.Columns["SpojeneRozmery"].HeaderText = "Spojené rozmery";
|
|
dataGridView12.Columns["SpojeneRozmery"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView12.Columns["Zakaznik"].HeaderText = "Zákazník";
|
|
dataGridView12.Columns["Zakaznik"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView12.Columns["InyNazov"].HeaderText = "Iný názov";
|
|
dataGridView12.Columns["InyNazov"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView12.Columns["RozlisZnakKonecnaOp"].HeaderText = "Rozliš. znak, koneč. operácia";
|
|
dataGridView12.Columns["RozlisZnakKonecnaOp"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView12.Columns["Alias"].HeaderText = "Alias";
|
|
dataGridView12.Columns["Alias"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView12.Columns["PocetSegmentov"].HeaderText = "Počet segmentov";
|
|
dataGridView12.Columns["PocetSegmentov"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView12.Columns["IDVyrobok"].HeaderText = "ID výrobok";
|
|
dataGridView12.Columns["IDVyrobok"].Visible = false;
|
|
dataGridView12.Columns["RozmerPolotovaru"].HeaderText = "Rozmer polotovaru";
|
|
|
|
dataGridView12.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView12.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
dataGridView12.AutoResizeColumns();
|
|
|
|
}
|
|
|
|
#endregion Výkresy
|
|
|
|
#region Sklad
|
|
private void tabPage17_Enter(object sender, EventArgs e)
|
|
{
|
|
refreshSklad();
|
|
button97.BackColor = Color.Orange;
|
|
button97.Text = "Obnovovanie vypnuté";
|
|
}
|
|
|
|
private void refreshSklad()
|
|
{
|
|
if (button97.Text == "Obnovovanie zapnuté")
|
|
{
|
|
int scrollBarHeight = 0;
|
|
if (dataGridView13.Controls.OfType<HScrollBar>().First().Visible == true) scrollBarHeight = dataGridView13.Controls.OfType<HScrollBar>().First().Height;
|
|
int headerHeight = dataGridView13.ColumnHeadersHeight;
|
|
if (headerHeight < 25) headerHeight = 47;
|
|
|
|
classSQL.intPocetNaStranu = Convert.ToInt32(Math.Floor((double)((dataGridView13.Height - headerHeight - scrollBarHeight - 2) / 22)));
|
|
|
|
string strTextBoxConditionNazov = " INSTR(`NazovVyrobku`, '" + textBox34.Text + "')>0 ";
|
|
string strTextBoxConditionZakaznik = " AND INSTR(`Zakaznik`, '" + textBox33.Text + "')>0 ";
|
|
string strTextBoxConditionRozmery = " AND INSTR(`SpojeneRozmery`, '" + textBox29.Text + "')>0 ";
|
|
|
|
string sqlCommandVydajMat = "SELECT * FROM `pohladskladcelkom` WHERE" + strTextBoxConditionNazov + strTextBoxConditionZakaznik + strTextBoxConditionRozmery + ";";
|
|
|
|
DataTable dtbSklad = new DataTable();
|
|
Int32 StartRecord = (Convert.ToInt32(numericUpDown11.Value) * classSQL.intPocetNaStranu) - classSQL.intPocetNaStranu;
|
|
|
|
classSQL.SQL(sqlCommandVydajMat, StartRecord, classSQL.intPocetNaStranu, out dtbSklad);
|
|
dataGridView13.DataSource = dtbSklad;
|
|
|
|
Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
label60.Text = "Strana: " + numericUpDown11.Value.ToString() + "/" + PocetStran.ToString();
|
|
if (PocetStran < 1) PocetStran = 1;
|
|
numericUpDown11.Maximum = PocetStran;
|
|
|
|
dataGVSetColumnSortMode(dataGridView13, DataGridViewColumnSortMode.NotSortable);
|
|
setDGV(dataGridView13, 0);
|
|
}
|
|
}
|
|
|
|
private void textBox34_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshSklad();
|
|
}
|
|
|
|
private void textBox33_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshSklad();
|
|
}
|
|
|
|
private void textBox29_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshSklad();
|
|
}
|
|
|
|
private void numericUpDown11_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
refreshSklad();
|
|
}
|
|
|
|
private void button96_Click(object sender, EventArgs e)
|
|
{
|
|
string strZak = dataGridView13.SelectedRows[0].Cells["Zakaznik"].Value.ToString();
|
|
string strIDVyr = dataGridView13.SelectedRows[0].Cells["IDVyrobok"].Value.ToString();
|
|
|
|
Form zobrazVykres = new frmShowVykres(strZak, Convert.ToInt32(strIDVyr));
|
|
zobrazVykres.Show();
|
|
}
|
|
|
|
private void dataGridView13_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
dataGridView13.Columns["NazovVyrobku"].HeaderText = "Názov výrobku";
|
|
dataGridView13.Columns["NazovVyrobku"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView13.Columns["SpojeneRozmery"].HeaderText = "Spojené rozmery";
|
|
dataGridView13.Columns["SpojeneRozmery"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView13.Columns["Zakaznik"].HeaderText = "Zákazník";
|
|
dataGridView13.Columns["Zakaznik"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView13.Columns["InyNazov"].HeaderText = "Iný názov";
|
|
dataGridView13.Columns["InyNazov"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView13.Columns["RozlisZnakKonecnaOp"].HeaderText = "Rozliš. znak, koneč. operácia";
|
|
dataGridView13.Columns["RozlisZnakKonecnaOp"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView13.Columns["Alias"].HeaderText = "Alias";
|
|
dataGridView13.Columns["Alias"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView13.Columns["PocetSegmentov"].HeaderText = "Počet segmentov";
|
|
dataGridView13.Columns["PocetSegmentov"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView13.Columns["IDVyrobok"].HeaderText = "ID výrobok";
|
|
dataGridView13.Columns["IDVyrobok"].Visible = false;
|
|
dataGridView13.Columns["MaterialSUpravouMat"].HeaderText = "Materiál";
|
|
dataGridView13.Columns["MaterialSUpravouMat"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView13.Columns["Počet na sklade"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
|
|
dataGridView13.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView13.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
dataGridView13.AutoResizeColumns();
|
|
}
|
|
|
|
private void button97_Click(object sender, EventArgs e)
|
|
{
|
|
if (button97.Text == "Obnovovanie zapnuté")
|
|
{
|
|
button97.BackColor = Color.Orange;
|
|
button97.Text = "Obnovovanie vypnuté";
|
|
}
|
|
else
|
|
{
|
|
button97.BackColor = Color.PaleGreen;
|
|
button97.Text = "Obnovovanie zapnuté";
|
|
refreshSklad();
|
|
}
|
|
}
|
|
|
|
private void button95_Click(object sender, EventArgs e)
|
|
{
|
|
classGlobal.DeleteRamDisk(); classGlobal.CreateRamDisk();
|
|
classSQL.ExportFormToHDD("Zoznam zo skladu.xls", @"W:\zzs.xls");
|
|
|
|
Excel.Application xlApp;
|
|
Excel.Workbook xlWorkBook;
|
|
Excel.Worksheet xlWorkSheet;
|
|
Excel.Range range;
|
|
|
|
xlApp = new Excel.Application();
|
|
xlWorkBook = xlApp.Workbooks.Open(@"W:\zzs.xls");
|
|
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
|
|
range = xlWorkSheet.UsedRange;
|
|
|
|
string strTextBoxConditionNazov = " INSTR(`NazovVyrobku`, '" + textBox34.Text + "')>0 ";
|
|
string strTextBoxConditionZakaznik = " AND INSTR(`Zakaznik`, '" + textBox33.Text + "')>0 ";
|
|
string strTextBoxConditionRozmery = " AND INSTR(`SpojeneRozmery`, '" + textBox29.Text + "')>0 ";
|
|
|
|
string cmdSklad = "SELECT * FROM `pohladskladcelkom` WHERE" + strTextBoxConditionNazov + strTextBoxConditionZakaznik + strTextBoxConditionRozmery + ";";
|
|
|
|
DataTable tblSklad = new DataTable();
|
|
classSQL.SQL(cmdSklad, out tblSklad);
|
|
|
|
for (int ri = 0; ri < tblSklad.Rows.Count; ri++)
|
|
{
|
|
int excelRowIndex = ri + 3;
|
|
DataRow dtrSklad = tblSklad.Rows[ri];
|
|
|
|
xlWorkSheet.Range["B" + excelRowIndex.ToString()].Value = dtrSklad["NazovVyrobku"].ToString();
|
|
xlWorkSheet.Range["C" + excelRowIndex.ToString()].Value = dtrSklad["Zakaznik"].ToString();
|
|
xlWorkSheet.Range["D" + excelRowIndex.ToString()].Value = dtrSklad["SpojeneRozmery"].ToString();
|
|
xlWorkSheet.Range["E" + excelRowIndex.ToString()].Value = dtrSklad["InyNazov"].ToString();
|
|
xlWorkSheet.Range["F" + excelRowIndex.ToString()].Value = dtrSklad["RozlisZnakKonecnaOp"].ToString();
|
|
xlWorkSheet.Range["G" + excelRowIndex.ToString()].Value = dtrSklad["Alias"].ToString();
|
|
xlWorkSheet.Range["H" + excelRowIndex.ToString()].Value = dtrSklad["PocetSegmentov"].ToString();
|
|
xlWorkSheet.Range["I" + excelRowIndex.ToString()].Value = dtrSklad["Počet na sklade"].ToString();
|
|
|
|
}
|
|
//vypocet poslednej strany tlacenia
|
|
double dNumber = Convert.ToDouble(tblSklad.Rows.Count) / Convert.ToDouble(31);
|
|
int lastrow = Convert.ToInt16(Math.Ceiling(dNumber) * 31); //'odpocita cislo prvej bunky kont tab., vydeli poctom riadkov na stramu (40), zaokruhli hore, a vynasobi poctom riadkov na stranu
|
|
xlWorkSheet.PageSetup.PrintArea = "$B$2:$I$" + (lastrow + 2);
|
|
|
|
xlApp.Visible = true;
|
|
xlApp.ActiveWindow.Activate();
|
|
xlWorkSheet.PrintPreview();
|
|
xlApp.Visible = false;
|
|
|
|
xlWorkBook.Save();
|
|
xlWorkBook.Close(false, null, null);
|
|
xlApp.Quit();
|
|
classGlobal.DeleteRamDisk();
|
|
|
|
}
|
|
|
|
private void dataGridView13_SelectionChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
DataTable tblPocty = new DataTable();
|
|
string strNazovRozmer = "";
|
|
string strMat = "";
|
|
|
|
if (dataGridView13.SelectedRows.Count > 0) strNazovRozmer = dataGridView13.SelectedRows[0].Cells["NazovVyrobku"].Value.ToString() + " [" + dataGridView13.SelectedRows[0].Cells["SpojeneRozmery"].Value.ToString() + "]";
|
|
if (dataGridView13.SelectedRows.Count > 0) strMat = " AND `MaterialSUpravouMat` = '" + dataGridView13.SelectedRows[0].Cells["MaterialSUpravouMat"].Value.ToString() + "'";
|
|
|
|
string cmdPocty = "SELECT CisKrabice, Pocet FROM `pohladkrabice-vyrobky` WHERE Nazov = '" + strNazovRozmer + "'" + strMat + " AND Pocet >0;";
|
|
classSQL.SQL(cmdPocty, out tblPocty);
|
|
dataGridView15.DataSource = tblPocty;
|
|
|
|
dataGridView15.Visible = true;
|
|
dataGVSetColumnSortMode(dataGridView15, DataGridViewColumnSortMode.NotSortable);
|
|
//setDGV(dataGridView15, 0);
|
|
}
|
|
|
|
private void dataGridView15_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
dataGridView15.Columns["CisKrabice"].HeaderText = "Číslo krabice";
|
|
dataGridView15.Columns["CisKrabice"].Width = 97;
|
|
dataGridView15.Columns["Pocet"].HeaderText = "Počet kusov";
|
|
dataGridView15.Columns["Pocet"].Width = 97;
|
|
|
|
dataGridView15.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView15.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView15.ClearSelection();
|
|
//dataGridView15.AutoResizeColumns();
|
|
}
|
|
|
|
#endregion Sklad
|
|
|
|
|
|
#region Naceňovanie
|
|
|
|
private void tabPage12_Enter(object sender, EventArgs e)
|
|
{
|
|
refreshNacenovanie();
|
|
//button97.BackColor = Color.Orange;
|
|
//button97.Text = "Obnovovanie vypnuté";
|
|
}
|
|
|
|
private void refreshNacenovanie()
|
|
{
|
|
int selectedIndex = 0;
|
|
if (dataGridView7.SelectedRows.Count > 0) selectedIndex = Convert.ToInt32(dataGridView7.SelectedRows[0].Index);
|
|
|
|
int scrollBarHeight = 0;
|
|
if (dataGridView7.Controls.OfType<HScrollBar>().First().Visible == true) scrollBarHeight = dataGridView7.Controls.OfType<HScrollBar>().First().Height;
|
|
int headerHeight = dataGridView7.ColumnHeadersHeight;
|
|
if (headerHeight < 25) headerHeight = 47;
|
|
|
|
classSQL.intPocetNaStranu = Convert.ToInt32(Math.Floor((double)((dataGridView7.Height - headerHeight - scrollBarHeight - 2) / 22)));
|
|
if (classSQL.intPocetNaStranu > 1)
|
|
{
|
|
if (dataGridView7.SelectedRows.Count > 0) classUser.IndexNacenovanie = Convert.ToInt32(dataGridView7[dataGridView7.Columns["IDNacenovanie"].Index, dataGridView7.SelectedRows[0].Index].Value.ToString());
|
|
else classUser.IndexNacenovanie = 0;
|
|
|
|
|
|
string strTextBoxCondition = ""; string strCheckBoxCondition = " WHERE (`Status` = 'Prázdna hodnota'";
|
|
|
|
foreach (CheckBox chb in groupBox2.Controls)
|
|
{
|
|
if (chb.Checked) strCheckBoxCondition = strCheckBoxCondition + " OR `Status` = '" + chb.Text + "'";
|
|
}
|
|
strCheckBoxCondition = strCheckBoxCondition + ")";
|
|
|
|
string strZoradenie = " ORDER BY `IDNacenovanie` DESC";
|
|
|
|
if (NacenovanieColorIndex > 0) strTextBoxCondition = " AND INSTR(`" + dataGridView7.Columns[NacenovanieColorIndex].Name + "`, '" + textBox35.Text + "')>0 ";
|
|
|
|
string sqlCommandNacenovanie = "SELECT * FROM `mip`.`pohladnacenovanie`" + strCheckBoxCondition + strTextBoxCondition + strZoradenie + ";";
|
|
|
|
DataTable dtbNacenovanie = new DataTable();
|
|
Int32 StartRecord = (Convert.ToInt32(numericUpDown13.Value) * classSQL.intPocetNaStranu) - classSQL.intPocetNaStranu;
|
|
|
|
classSQL.SQL(sqlCommandNacenovanie, StartRecord, classSQL.intPocetNaStranu, out dtbNacenovanie);
|
|
dataGridView7.DataSource = dtbNacenovanie;
|
|
|
|
Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
label64.Text = numericUpDown13.Value.ToString() + "/" + PocetStran.ToString();
|
|
if (PocetStran < 1) PocetStran = 1;
|
|
numericUpDown13.Maximum = PocetStran;
|
|
|
|
dataGVSetColumnSortMode(dataGridView7, DataGridViewColumnSortMode.NotSortable);
|
|
setDGV(dataGridView7, classUser.IndexNacenovanie, textBox35);
|
|
}
|
|
|
|
if (dataGridView7.Rows.Count != 0)
|
|
if (selectedIndex <= dataGridView7.Rows.Count - 1) dataGridView7.Rows[selectedIndex].Selected = true;
|
|
else if ((selectedIndex - 1) >= dataGridView7.Rows.Count) dataGridView7.Rows[dataGridView7.Rows.Count - 1].Selected = true;
|
|
else dataGridView7.Rows[selectedIndex - 1].Selected = true;
|
|
/*
|
|
if (dataGridView7.Rows.Count != 0)
|
|
if (selectedIndex <= dataGridView7.Rows.Count - 1) dataGridView7.Rows[selectedIndex].Selected = true;
|
|
else dataGridView7.Rows[selectedIndex - 1].Selected = true;
|
|
*/
|
|
lblZobrazenyPocet.Text = classSQL.intCelkovyPocetZazanmov.ToString();
|
|
|
|
}
|
|
|
|
int NacenovanieColorIndex = -1;
|
|
private void dataGridView7_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
if (NacenovanieColorIndex != -1)
|
|
{
|
|
NacenovanieColorIndex = -1;
|
|
textBox35.Text = "";
|
|
textBox35.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
NacenovanieColorIndex = e.ColumnIndex;
|
|
textBox35.Text = "";
|
|
textBox35.Enabled = true;
|
|
}
|
|
|
|
/*
|
|
if(NacenovanieColorIndex != e.ColumnIndex && NacenovanieColorIndex != -1) dataGridView7.Columns[NacenovanieColorIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
|
|
if (dataGridView7.Columns[e.ColumnIndex].DefaultCellStyle.BackColor == Color.Empty)
|
|
{
|
|
dataGridView7.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.GreenYellow;
|
|
NacenovanieColorIndex = e.ColumnIndex;
|
|
textBox35.Text = "";
|
|
textBox35.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
dataGridView7.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
NacenovanieColorIndex = -1;
|
|
textBox35.Text = "";
|
|
textBox35.Enabled = false;
|
|
}
|
|
*/
|
|
}
|
|
|
|
|
|
#endregion Naceňovanie
|
|
|
|
|
|
#region Požiadavky
|
|
|
|
|
|
private void checkBox60_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
if (checkBox60.Checked == true)
|
|
{
|
|
checkBox60.Text = "Aktívne";
|
|
label23.BackColor = Color.PaleGreen;
|
|
lblZobrazenyPocet.BackColor = Color.PaleGreen;
|
|
checkBox60.BackColor = Color.PaleGreen;
|
|
panel46.BackColor = Color.PaleGreen;
|
|
}
|
|
else
|
|
{
|
|
checkBox60.Text = "Neaktívne";
|
|
label23.BackColor = Color.Empty;
|
|
lblZobrazenyPocet.BackColor = Color.Empty;
|
|
checkBox60.BackColor = Color.Empty;
|
|
panel46.BackColor = Color.Empty;
|
|
}
|
|
|
|
}
|
|
|
|
private void button104_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel45.Visible == false) panel45.Visible = true;
|
|
else panel45.Visible = false;
|
|
}
|
|
|
|
private void button108_Click(object sender, EventArgs e)
|
|
{
|
|
panel45.Visible = false;
|
|
}
|
|
|
|
private void button109_Click(object sender, EventArgs e)
|
|
{
|
|
string strUser = "";
|
|
|
|
strUser = classUser.Titul.ToString() + " " + classUser.Meno.ToString() + " " + classUser.Priezvisko.ToString();
|
|
|
|
string cmd = @"INSERT INTO `mip`.`tabpoziadavky` (`Poziadavka`, `StatusPoziadavky`, `DatumZadania`, `Uzivatel`)
|
|
VALUES ('"
|
|
+ textBox36.Text + "', '"
|
|
+ "Zadaná', "
|
|
+ "DATE(NOW()), '"
|
|
+ strUser + "');";
|
|
|
|
classSQL.SQL(cmd);
|
|
panel45.Visible = false;
|
|
textBox36.Text = "";
|
|
refreshPoziadavky();
|
|
}
|
|
|
|
private void textBox36_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (textBox36.Text == "") button109.Enabled = false;
|
|
else button109.Enabled = true;
|
|
|
|
}
|
|
|
|
private void refreshPoziadavky()
|
|
{
|
|
|
|
int scrollBarHeight = 0;
|
|
if (dataGridView14.Controls.OfType<HScrollBar>().First().Visible == true) scrollBarHeight = dataGridView14.Controls.OfType<HScrollBar>().First().Height;
|
|
int headerHeight = dataGridView14.ColumnHeadersHeight;
|
|
if (headerHeight < 25) headerHeight = 34;
|
|
|
|
if (dataGridView14.SelectedRows.Count > 0) classUser.IndexPoziadavka = Convert.ToInt32(dataGridView14[dataGridView14.Columns["IDPoziadavka"].Index, dataGridView14.SelectedRows[0].Index].RowIndex);
|
|
else classUser.IndexPoziadavka = 0;
|
|
|
|
classSQL.intPocetNaStranu = Convert.ToInt32(Math.Floor((double)((dataGridView14.Height - headerHeight - scrollBarHeight - 2) / 22)));
|
|
|
|
string strCheckBoxStatusCondition = " (`StatusPoziadavky` = 'Prázdna hodnota'";
|
|
foreach (CheckBox chb in groupBox4.Controls)
|
|
{
|
|
if (chb.Checked) strCheckBoxStatusCondition = strCheckBoxStatusCondition + " OR `StatusPoziadavky` = '" + chb.Text + "'";
|
|
}
|
|
strCheckBoxStatusCondition = strCheckBoxStatusCondition + ")";
|
|
|
|
string sqlCommandpoziadavky;
|
|
sqlCommandpoziadavky = @"SELECT * FROM `tabpoziadavky` WHERE " + strCheckBoxStatusCondition + " ORDER BY `IDPoziadavka` DESC;";
|
|
|
|
DataTable outdtbl = new DataTable();
|
|
Int32 StartRecord = (Convert.ToInt32(numericUpDown23.Value) * classSQL.intPocetNaStranu) - classSQL.intPocetNaStranu;
|
|
classSQL.SQL(sqlCommandpoziadavky, StartRecord, classSQL.intPocetNaStranu, out outdtbl);
|
|
dataGridView14.DataSource = outdtbl;
|
|
|
|
Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
label65.Text = numericUpDown23.Value.ToString() + "/" + PocetStran.ToString();
|
|
if (PocetStran < 1) PocetStran = 1;
|
|
numericUpDown23.Maximum = PocetStran;
|
|
|
|
dataGVSetColumnSortMode(dataGridView14, DataGridViewColumnSortMode.NotSortable);
|
|
setDGV(dataGridView14, classUser.IndexPoziadavka);
|
|
//dataGridView14.Visible = true;
|
|
|
|
lblZobrazenyPocet.Text = classSQL.intCelkovyPocetZazanmov.ToString();
|
|
}
|
|
|
|
private void tabPage18_Enter(object sender, EventArgs e)
|
|
{
|
|
refreshPoziadavky();
|
|
}
|
|
|
|
private void button105_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel43.Visible == false) panel43.Visible = true;
|
|
else panel43.Visible = false;
|
|
}
|
|
|
|
private void panel44_Click(object sender, EventArgs e)
|
|
{
|
|
checkBox52.Checked = true;
|
|
checkBox53.Checked = true;
|
|
checkBox54.Checked = true;
|
|
checkBox55.Checked = true;
|
|
}
|
|
|
|
private void checkBox55_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshPoziadavky();
|
|
}
|
|
|
|
private void checkBox54_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshPoziadavky();
|
|
}
|
|
|
|
private void checkBox53_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshPoziadavky();
|
|
}
|
|
|
|
private void checkBox52_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshPoziadavky();
|
|
}
|
|
|
|
private void numericUpDown23_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
refreshPoziadavky();
|
|
}
|
|
|
|
private void button103_Click(object sender, EventArgs e)
|
|
{
|
|
string commandUpdate = "UPDATE `mip`.`tabpoziadavky` SET `StatusPoziadavky` = 'Čiastočne dokončená' WHERE `IDPoziadavka`="
|
|
+ dataGridView14.SelectedRows[0].Cells["IDPoziadavka"].Value.ToString() + ";";
|
|
classSQL.SQL(commandUpdate);
|
|
refreshPoziadavky();
|
|
}
|
|
|
|
private void button106_Click(object sender, EventArgs e)
|
|
{
|
|
string commandUpdate = "UPDATE `mip`.`tabpoziadavky` SET `StatusPoziadavky` = 'Dokončená' WHERE `IDPoziadavka`="
|
|
+ dataGridView14.SelectedRows[0].Cells["IDPoziadavka"].Value.ToString() + ";";
|
|
classSQL.SQL(commandUpdate);
|
|
refreshPoziadavky();
|
|
}
|
|
|
|
private void button107_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
string commandUpdate = "UPDATE `mip`.`tabpoziadavky` SET `StatusPoziadavky` = 'Zrušená' WHERE `IDPoziadavka`="
|
|
+ dataGridView14.SelectedRows[0].Cells["IDPoziadavka"].Value.ToString() + ";";
|
|
classSQL.SQL(commandUpdate);
|
|
refreshPoziadavky();
|
|
}
|
|
|
|
private void dataGridView14_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
classUser.IndexPoziadavka = e.RowIndex;
|
|
}
|
|
|
|
private void dataGridView14_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
dataGridView14.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView14.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView14.Columns["Poziadavka"].HeaderText = "Požiadavka";
|
|
dataGridView14.Columns["StatusPoziadavky"].HeaderText = "Status požiadavky";
|
|
dataGridView14.Columns["DatumZadania"].HeaderText = "Dátum zadania";
|
|
dataGridView14.Columns["Uzivatel"].HeaderText = "Meno zadavajúceho";
|
|
dataGridView14.Columns["Poznamka"].HeaderText = "Poznámka";
|
|
dataGridView14.Columns["IDPoziadavka"].Visible = false;
|
|
|
|
//nastavenie velkosti stlpcov
|
|
dataGridView14.Columns["Poziadavka"].Width = 900;
|
|
dataGridView14.Columns["StatusPoziadavky"].MinimumWidth = 100;
|
|
dataGridView14.Columns["StatusPoziadavky"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView14.Columns["DatumZadania"].MinimumWidth = 60;
|
|
dataGridView14.Columns["DatumZadania"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView14.Columns["Uzivatel"].MinimumWidth = 60;
|
|
dataGridView14.Columns["Uzivatel"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView14.Columns["Poznamka"].MinimumWidth = 100;
|
|
dataGridView14.Columns["Poznamka"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
|
|
}
|
|
|
|
#endregion Požiadavky
|
|
|
|
private void button57_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView7.SelectedRows.Count > 0)
|
|
{
|
|
OpenNacenovanie();
|
|
}
|
|
refreshNacenovanie();
|
|
}
|
|
|
|
private void dataGridView7_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
OpenNacenovanie();
|
|
}
|
|
|
|
private void OpenNacenovanie()
|
|
{
|
|
if (classUser.ID == 1 || classUser.ID == 4 || classUser.ID == 26)
|
|
{
|
|
Form frmNacenovanie2 = new frmNacenovanie(Convert.ToInt32(dataGridView7.SelectedRows[0].Cells["IDNacenovanie"].Value), Convert.ToInt32(dataGridView7.SelectedRows[0].Cells["IDVyrobokNac"].Value), true, false, true, true, true, true);
|
|
frmNacenovanie2.Text = "Naceňovanie - vyhodnocovanie";
|
|
frmNacenovanie2.ShowDialog();
|
|
refreshNacenovanie();
|
|
}
|
|
else
|
|
{
|
|
Form frmNacenovanie2 = new frmNacenovanie(Convert.ToInt32(dataGridView7.SelectedRows[0].Cells["IDNacenovanie"].Value), Convert.ToInt32(dataGridView7.SelectedRows[0].Cells["IDVyrobokNac"].Value), false, false, false, false, true, false);
|
|
frmNacenovanie2.Text = "Naceňovanie - vyhodnocovanie";
|
|
frmNacenovanie2.ShowDialog();
|
|
}
|
|
}
|
|
|
|
private void button112_Click(object sender, EventArgs e)
|
|
{
|
|
classGlobal.DeleteRamDisk(); classGlobal.CreateRamDisk();
|
|
classSQL.ExportFormToHDD("Plán preventívnych údržieb.xls", @"W:\PU.xls");
|
|
|
|
Excel.Application xlApp;
|
|
Excel.Workbook xlWorkBook;
|
|
Excel.Worksheet xlWorkSheet;
|
|
Excel.Range range;
|
|
|
|
xlApp = new Excel.Application();
|
|
xlWorkBook = xlApp.Workbooks.Open(@"W:\PU.xls");
|
|
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
|
|
range = xlWorkSheet.UsedRange;
|
|
|
|
DataTable tblTlacitPU = new DataTable();
|
|
|
|
string cmdPU = @"SELECT `PeriodaPU`, `MesiacPU`, `PopisPU` FROM tabudrzba WHERE IDStroja = " + dGVStroje.SelectedRows[0].Cells["IDStroj"].Value.ToString() + ";";
|
|
classSQL.SQL(cmdPU, out tblTlacitPU);
|
|
|
|
xlWorkSheet.Range["D3", "J3"].Value = dGVStroje.SelectedRows[0].Cells["TypStroja"].Value.ToString() + " - " + dGVStroje.SelectedRows[0].Cells["Vyrobca"].Value.ToString();//week.ToString() + ". Kalendárny týždeň";
|
|
xlWorkSheet.Range["D4", "F4"].Value = dGVStroje.SelectedRows[0].Cells["ModelStroja"].Value.ToString();
|
|
xlWorkSheet.Range["H4", "J4"].Value = dGVStroje.SelectedRows[0].Cells["Dielna"].Value.ToString();
|
|
xlWorkSheet.Range["D5", "F5"].Value = dGVStroje.SelectedRows[0].Cells["PoznamkaStroj"].Value.ToString();
|
|
xlWorkSheet.Range["H5", "J5"].Value = dGVStroje.SelectedRows[0].Cells["INVCislo"].Value.ToString();
|
|
|
|
for (int ri = 0; ri < tblTlacitPU.Rows.Count; ri++)
|
|
{
|
|
int excelRowIndex = ri + 7;
|
|
DataRow dtrTlacitPU = tblTlacitPU.Rows[ri];
|
|
|
|
xlWorkSheet.Range["C" + excelRowIndex.ToString(), "J" + excelRowIndex.ToString()].Value = dtrTlacitPU["PeriodaPU"].ToString();
|
|
xlWorkSheet.Range["D" + excelRowIndex.ToString(), "J" + excelRowIndex.ToString()].Value = dtrTlacitPU["MesiacPU"].ToString();
|
|
xlWorkSheet.Range["E" + excelRowIndex.ToString(), "J" + excelRowIndex.ToString()].Value = dtrTlacitPU["PopisPU"].ToString();
|
|
|
|
}
|
|
|
|
xlWorkSheet.PageSetup.PrintArea = "$B$2:$J$21";
|
|
|
|
xlApp.Visible = true;
|
|
xlApp.ActiveWindow.Activate();
|
|
xlWorkSheet.PrintPreview();
|
|
xlApp.Visible = false;
|
|
|
|
xlWorkBook.Save();
|
|
xlWorkBook.Close(false, null, null);
|
|
xlApp.Quit();
|
|
classGlobal.DeleteRamDisk();
|
|
|
|
}
|
|
|
|
private void button113_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
string cmdDelete = @"DELETE FROM tabudrzba WHERE IDUdrzba = " + dGVPU.SelectedRows[0].Cells["IDUdrzba"].Value.ToString() + ";";
|
|
classSQL.SQL(cmdDelete);
|
|
}
|
|
|
|
private void button114_Click(object sender, EventArgs e)
|
|
{
|
|
string strPoznamka = dGVRV.Rows[dGVRV.SelectedRows[0].Index].Cells["PoznamkaOBJ"].Value.ToString();
|
|
panel9.Visible = true;
|
|
textBox7.Focus();
|
|
textBox7.Text = strPoznamka;
|
|
|
|
}
|
|
|
|
private void button115_Click(object sender, EventArgs e)
|
|
{
|
|
string strIDOBJ = dGVRV.Rows[dGVRV.SelectedRows[0].Index].Cells["IDCPOBJ"].Value.ToString();
|
|
string cmdUpdate = "UPDATE `tabdopyt` SET `PoznamkaOBJ` = '" + textBox7.Text + "' WHERE `IDCPOBJ`=" + strIDOBJ + ";";
|
|
classSQL.SQL(cmdUpdate);
|
|
panel9.Visible = false;
|
|
textBox7.Text = "";
|
|
refreshRV();
|
|
|
|
}
|
|
|
|
private void panel9_Leave(object sender, EventArgs e)
|
|
{
|
|
panel9.Visible = false;
|
|
}
|
|
|
|
private void button117_Click(object sender, EventArgs e)
|
|
{
|
|
// Zoznam výrobkov v sklade podľa krabíc
|
|
// malo by fungovat dobre
|
|
|
|
|
|
classGlobal.DeleteRamDisk(); classGlobal.CreateRamDisk();
|
|
classSQL.ExportFormToHDD("Zoznam výrobkov v sklade podľa krabíc.xls", @"W:\zvvspk.xls");
|
|
|
|
Excel.Application xlApp;
|
|
Excel.Workbook xlWorkBook;
|
|
Excel.Worksheet xlWorkSheet;
|
|
Excel.Range range;
|
|
|
|
xlApp = new Excel.Application();
|
|
xlWorkBook = xlApp.Workbooks.Open(@"W:\zvvspk.xls");
|
|
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
|
|
range = xlWorkSheet.UsedRange;
|
|
|
|
DataTable tblTlacitZoznamy = new DataTable();
|
|
|
|
string cmdZoznamy = "SELECT * FROM `pohladkrabice-krabice` WHERE pocet !=0;";
|
|
classSQL.SQL(cmdZoznamy, out tblTlacitZoznamy);
|
|
|
|
for (int ri = 0; ri < tblTlacitZoznamy.Rows.Count; ri++)
|
|
{
|
|
int excelRowIndex = ri + 4;
|
|
DataRow dtrTlacitZoznamy = tblTlacitZoznamy.Rows[ri];
|
|
|
|
|
|
xlWorkSheet.Range["B" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["CisKrabice"].ToString();
|
|
xlWorkSheet.Range["C" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["Nazov"].ToString();
|
|
xlWorkSheet.Range["D" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["MaterialSUpravouMat"].ToString();
|
|
xlWorkSheet.Range["E" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["Pocet"].ToString();
|
|
|
|
}
|
|
//vypocet poslednej strany tlacenia
|
|
double dNumber = Convert.ToDouble(tblTlacitZoznamy.Rows.Count) / Convert.ToDouble(53);
|
|
int lastrow = Convert.ToInt16(Math.Ceiling(dNumber) * 53);
|
|
xlWorkSheet.PageSetup.PrintArea = "$B$2:$E$" + (lastrow + 3);
|
|
|
|
xlApp.Visible = true;
|
|
xlApp.ActiveWindow.Activate();
|
|
xlWorkSheet.PrintPreview();
|
|
xlApp.Visible = false;
|
|
|
|
xlWorkBook.Save();
|
|
xlWorkBook.Close(false, null, null);
|
|
xlApp.Quit();
|
|
classGlobal.DeleteRamDisk();
|
|
|
|
|
|
}
|
|
|
|
private void button116_Click(object sender, EventArgs e)
|
|
{
|
|
// Zoznam výrobkov v sklade podľa výrobkov
|
|
// malo by fungovat dobre
|
|
|
|
|
|
classGlobal.DeleteRamDisk(); classGlobal.CreateRamDisk();
|
|
classSQL.ExportFormToHDD("Zoznam výrobkov v sklade podľa krabíc.xls", @"W:\zvvspk.xls");
|
|
|
|
Excel.Application xlApp;
|
|
Excel.Workbook xlWorkBook;
|
|
Excel.Worksheet xlWorkSheet;
|
|
Excel.Range range;
|
|
|
|
xlApp = new Excel.Application();
|
|
xlWorkBook = xlApp.Workbooks.Open(@"W:\zvvspk.xls");
|
|
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
|
|
range = xlWorkSheet.UsedRange;
|
|
|
|
xlWorkSheet.Range["B2:D2"].Value = "Zoznam výrobkov v sklade podľa výrobkov";
|
|
DataTable tblTlacitZoznamy = new DataTable();
|
|
|
|
string cmdZoznamy = "SELECT * FROM `pohladkrabice-vyrobky` WHERE pocet !=0;";
|
|
classSQL.SQL(cmdZoznamy, out tblTlacitZoznamy);
|
|
|
|
for (int ri = 0; ri < tblTlacitZoznamy.Rows.Count; ri++)
|
|
{
|
|
int excelRowIndex = ri + 4;
|
|
DataRow dtrTlacitZoznamy = tblTlacitZoznamy.Rows[ri];
|
|
|
|
|
|
xlWorkSheet.Range["B" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["CisKrabice"].ToString();
|
|
xlWorkSheet.Range["C" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["Nazov"].ToString();
|
|
xlWorkSheet.Range["D" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["MaterialSUpravouMat"].ToString();
|
|
xlWorkSheet.Range["E" + excelRowIndex.ToString()].Value = dtrTlacitZoznamy["Pocet"].ToString();
|
|
|
|
}
|
|
//vypocet poslednej strany tlacenia
|
|
double dNumber = Convert.ToDouble(tblTlacitZoznamy.Rows.Count) / Convert.ToDouble(53);
|
|
int lastrow = Convert.ToInt16(Math.Ceiling(dNumber) * 53);
|
|
xlWorkSheet.PageSetup.PrintArea = "$B$2:$E$" + (lastrow + 3);
|
|
|
|
xlApp.Visible = true;
|
|
xlApp.ActiveWindow.Activate();
|
|
xlWorkSheet.PrintPreview();
|
|
xlApp.Visible = false;
|
|
|
|
xlWorkBook.Save();
|
|
xlWorkBook.Close(false, null, null);
|
|
xlApp.Quit();
|
|
classGlobal.DeleteRamDisk();
|
|
|
|
}
|
|
|
|
private void btnTlacitForm_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void button118_Click(object sender, EventArgs e)
|
|
{
|
|
classGlobal.DeleteRamDisk(); classGlobal.CreateRamDisk();
|
|
classSQL.ExportFormToHDD("Kontrolný list - predná strana.xls", @"W:\tlps.xls");
|
|
|
|
Excel.Application xlApp;
|
|
Excel.Workbook xlWorkBook;
|
|
Excel.Worksheet xlWorkSheet;
|
|
Excel.Range range;
|
|
|
|
xlApp = new Excel.Application();
|
|
xlWorkBook = xlApp.Workbooks.Open(@"W:\tlps.xls");
|
|
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
|
|
|
|
range = xlWorkSheet.UsedRange;
|
|
|
|
xlApp.Visible = true;
|
|
xlApp.ActiveWindow.Activate();
|
|
xlWorkSheet.PrintPreview();
|
|
|
|
xlApp.Visible = false;
|
|
|
|
xlWorkBook.Save();
|
|
xlWorkBook.Close(false, null, null);
|
|
xlApp.Quit();
|
|
|
|
classGlobal.DeleteRamDisk();
|
|
|
|
panel48.Visible = false;
|
|
|
|
}
|
|
|
|
private void button119_Click(object sender, EventArgs e)
|
|
{
|
|
classGlobal.DeleteRamDisk(); classGlobal.CreateRamDisk();
|
|
classSQL.ExportFormToHDD("Kontrolný list - zadná strana.xls", @"W:\tlzs.xls");
|
|
|
|
Excel.Application xlApp;
|
|
Excel.Workbook xlWorkBook;
|
|
Excel.Worksheet xlWorkSheet;
|
|
Excel.Range range;
|
|
|
|
xlApp = new Excel.Application();
|
|
xlWorkBook = xlApp.Workbooks.Open(@"W:\tlzs.xls");
|
|
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
|
|
range = xlWorkSheet.UsedRange;
|
|
|
|
xlApp.Visible = true;
|
|
xlApp.ActiveWindow.Activate();
|
|
xlWorkSheet.PrintPreview();
|
|
xlApp.Visible = false;
|
|
|
|
xlWorkBook.Save();
|
|
xlWorkBook.Close(false, null, null);
|
|
xlApp.Quit();
|
|
|
|
classGlobal.DeleteRamDisk();
|
|
|
|
panel48.Visible = false;
|
|
}
|
|
|
|
private void button120_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel48.Visible == true) panel48.Visible = false;
|
|
else panel48.Visible = true;
|
|
}
|
|
|
|
private void dataGridView7_RowEnter(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (dataGridView7.SelectedRows.Count == 1)
|
|
{
|
|
DataGridViewRow dtgvr = dataGridView7.SelectedRows[0];
|
|
if (dtgvr.Cells["Status"].Value.ToString() == "Prijatá") button57.Text = "Naceniť";
|
|
else button57.Text = "Editovať";
|
|
if (dtgvr.Cells["Status vyhodnotenia"].Value.ToString() == "Vyhodnotená") button206.Enabled = true;
|
|
else button206.Enabled = false;
|
|
if (dtgvr.Cells["Status"].Value.ToString() == "Nacenená" && dtgvr.Cells["Status vyhodnotenia"].Value.ToString() == "") button207.Enabled = true;
|
|
else button207.Enabled = false;
|
|
}
|
|
}
|
|
|
|
private void button98_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel23.Visible == true) panel23.Visible = false;
|
|
else panel23.Visible = true;
|
|
}
|
|
|
|
private void button121_Click(object sender, EventArgs e)
|
|
{
|
|
DataGridViewRow dtrw = dataGridView1.SelectedRows[0];
|
|
if (dtrw.Cells["TypDopytu"].Value.ToString() == "Cenová ponuka")
|
|
{
|
|
if (dtrw.Cells["Status"].Value.ToString() == "Nacenená")
|
|
{
|
|
Form frmNacenovanie2 = new frmNacenovanie(Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["IDNacenovanie"].Value), Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["IDVyrobok"].Value), false, false, false, false, true, false);
|
|
frmNacenovanie2.Text = "Naceňovanie - vyhodnocovanie";
|
|
frmNacenovanie2.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Cenová ponuka nie je nacenená a nedá sa vytlačiť!");
|
|
}
|
|
}
|
|
}
|
|
|
|
private void button122_Click(object sender, EventArgs e)
|
|
{
|
|
Form frmNovaPoziadavka2 = new frmNovaPoziadavka();
|
|
frmNovaPoziadavka2.ShowDialog();
|
|
refreshZiadanky();
|
|
}
|
|
|
|
//ziadankovy system - panely resize, minimize, maximize
|
|
/*
|
|
bool P49mouseClicked = false;
|
|
int P49currentWidth = 300;
|
|
int P49currentHeight = 365;
|
|
private void pictureBox4_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
P49mouseClicked = true;
|
|
}
|
|
|
|
private void pictureBox4_MouseUp(object sender, MouseEventArgs e)
|
|
{
|
|
P49mouseClicked = false;
|
|
}
|
|
|
|
private void pictureBox4_MouseMove(object sender, MouseEventArgs e)
|
|
{
|
|
if (P49mouseClicked)
|
|
{
|
|
this.panel49.Height = pictureBox4.Top + e.Y;
|
|
this.panel49.Width = pictureBox4.Left + e.X;
|
|
|
|
P49currentHeight = panel49.Size.Height;
|
|
P49currentWidth = panel49.Size.Width;
|
|
}
|
|
}
|
|
|
|
private void pictureBox7_Click(object sender, EventArgs e)
|
|
{
|
|
int min;
|
|
if (pictureBox7.Parent.Size.Height == pictureBox7.Parent.MinimumSize.Height)
|
|
{
|
|
min = P49currentHeight;
|
|
pictureBox7.Image = Mip.Properties.Resources.down;
|
|
}
|
|
else
|
|
{
|
|
min = pictureBox7.Parent.MinimumSize.Height;
|
|
pictureBox7.Image = Mip.Properties.Resources.up;
|
|
}
|
|
pictureBox7.Parent.Size = new Size(P49currentWidth, min);
|
|
}
|
|
|
|
bool P50mouseClicked = false;
|
|
private void pictureBox5_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
P50mouseClicked = true;
|
|
}
|
|
|
|
private void pictureBox5_MouseUp(object sender, MouseEventArgs e)
|
|
{
|
|
P50mouseClicked = false;
|
|
}
|
|
|
|
private void pictureBox5_MouseMove(object sender, MouseEventArgs e)
|
|
{
|
|
if (P50mouseClicked)
|
|
{
|
|
this.panel50.Height = pictureBox5.Top + e.Y;
|
|
this.panel50.Width = pictureBox5.Left + e.X;
|
|
}
|
|
}
|
|
|
|
bool P51mouseClicked = false;
|
|
private void pictureBox6_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
P51mouseClicked = true;
|
|
}
|
|
|
|
private void pictureBox6_MouseUp(object sender, MouseEventArgs e)
|
|
{
|
|
P51mouseClicked = false;
|
|
}
|
|
|
|
private void pictureBox6_MouseMove(object sender, MouseEventArgs e)
|
|
{
|
|
if (P51mouseClicked)
|
|
{
|
|
this.panel51.Height = pictureBox6.Top + e.Y;
|
|
this.panel51.Width = pictureBox6.Left + e.X;
|
|
}
|
|
}
|
|
*/
|
|
|
|
private void button131_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
|
|
}
|
|
|
|
private void button132_Click(object sender, EventArgs e)
|
|
{
|
|
Form frmTlacitStatistiku2 = new frmTlacitStatistiku();
|
|
frmTlacitStatistiku2.ShowDialog();
|
|
}
|
|
|
|
private void button133_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
if (dGVZoznamVyrobkov.SelectedRows.Count != 0)
|
|
{
|
|
Form frmAddCenovuPonuku2 = new frmAddCenovuPonuku(dGVZoznamVyrobkov.SelectedRows[0].Cells["NazovVyrobku"].Value.ToString(),
|
|
Convert.ToInt32(dGVZoznamVyrobkov.SelectedRows[0].Cells["IDVyrobok"].Value.ToString()),
|
|
dGVZoznamVyrobkov.SelectedRows[0].Cells["Zakaznik"].Value.ToString(),
|
|
dGVZoznamVyrobkov.SelectedRows[0].Cells["SpojeneRozmery"].Value.ToString(),
|
|
Convert.ToInt32(dGVZoznamVyrobkov.SelectedRows[0].Cells["PocetSegmentov"].Value.ToString()));
|
|
frmAddCenovuPonuku2.ShowDialog();
|
|
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Nebol vybraný žiadny výrobok!");
|
|
}
|
|
}
|
|
|
|
private void button134_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
if ((dGVZoznamVyrobkov.SelectedRows.Count != 0) && (Convert.ToInt32(dGVZoznamVyrobkov.SelectedRows[0].Cells["Počet naceňovaní"].Value) != 0))
|
|
{
|
|
Form frmEditCenovuPonuku2 = new frmEditCenovuPonuku(Convert.ToInt32(dGVZoznamVyrobkov.SelectedRows[0].Cells["IDVyrobok"].Value.ToString()));
|
|
frmEditCenovuPonuku2.ShowDialog();
|
|
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Nebol vybraný žiadny výrobok alebo počet naceňonaní pre výrobok je 0!");
|
|
}
|
|
}
|
|
|
|
private void button125_Click(object sender, EventArgs e)
|
|
{
|
|
Form frmEditPoziadanka2 = new frmEditPoziadavka(Convert.ToInt32(dataGridView16.SelectedRows[0].Cells["IDZiadanka"].Value));
|
|
frmEditPoziadanka2.ShowDialog();
|
|
}
|
|
|
|
private void tabPage19_Enter(object sender, EventArgs e)
|
|
{
|
|
if (classGlobal.PristupovePrava(classUser.ID, "Ziadanka-schvalit") == false) panel49.Enabled = false;
|
|
if (classGlobal.PristupovePrava(classUser.ID, "Ziadanka-operacie") == false) panel50.Enabled = false;
|
|
|
|
if (MessageBox.Show("Zobraziť najprv termínovo nepotvrdené a nedoručené objednávky?", "Upozornenie!", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
labelVsetkyAleboMeskajuce.Tag = false;
|
|
labelVsetkyAleboMeskajuce.Text = "Meškajúce";
|
|
refreshNepotvrdeneNedoruceneZiadanky();
|
|
}
|
|
else
|
|
{
|
|
labelVsetkyAleboMeskajuce.Tag = true;
|
|
labelVsetkyAleboMeskajuce.Text = "Všetky";
|
|
refreshZiadanky();
|
|
}
|
|
}
|
|
|
|
private void refreshNepotvrdeneNedoruceneZiadanky()
|
|
{
|
|
string sqlCommandZiadanky;
|
|
sqlCommandZiadanky = @"SELECT * FROM `pohlad-ziadanka`
|
|
WHERE `Status` = 'True'
|
|
AND (`Status žiadanky` = '#&@' OR (`Status žiadanky` = 'Dopyt odoslaný' AND `Termín` <= NOW()) OR (`Status žiadanky` = 'Objednávka odoslaná' AND `Termín` <= NOW()) OR (`Status žiadanky` = 'Potvrdená' AND `Potvrdený dátum` <= NOW()))
|
|
ORDER BY `IDZiadanka` DESC;";
|
|
|
|
DataTable outdtbl = new DataTable();
|
|
|
|
classSQL.SQL(sqlCommandZiadanky, out outdtbl);
|
|
dataGridView16.DataSource = outdtbl;
|
|
|
|
lblZobrazenyPocet.Text = classSQL.intCelkovyPocetZazanmov.ToString();
|
|
}
|
|
|
|
void refreshZiadanky()
|
|
{
|
|
ReloadSelected = false;
|
|
int selectedIndex = 0;
|
|
if (dataGridView16.SelectedRows.Count > 0) selectedIndex = Convert.ToInt32(dataGridView16.SelectedRows[0].Index);
|
|
|
|
|
|
string strTextBoxCondition = $"{textBox52.Tag} {textBox38.Tag}";
|
|
//if (ZiadankyColorIndex > 0) strTextBoxCondition = " AND INSTR(`" + dataGridView16.Columns[ZiadankyColorIndex].Name + "`, '" + textBox38.Text + "')>0 ";
|
|
|
|
string sqlCommandZiadanky;
|
|
string strCommandZiadankyWhere = "WHERE (`IDUser` = " + classUser.ID.ToString() + ")";
|
|
string strCommandZiadankyVymazane = "";
|
|
|
|
if (checkBox64.Checked == true)
|
|
{
|
|
strCommandZiadankyVymazane = "";
|
|
if (checkBox63.Checked == true) strCommandZiadankyWhere = "";
|
|
else strCommandZiadankyWhere = "WHERE (`IDUser` = " + classUser.ID.ToString() + ")";// + strCommandZiadankyVymazane;
|
|
}
|
|
else
|
|
{
|
|
strCommandZiadankyVymazane = "`Status` = 'True'";
|
|
if (checkBox63.Checked == true) strCommandZiadankyWhere = "WHERE " + strCommandZiadankyVymazane;
|
|
else strCommandZiadankyWhere = "WHERE (`IDUser` = " + classUser.ID.ToString() + " AND " + strCommandZiadankyVymazane + ")";
|
|
}
|
|
|
|
string strCheckBox = "(`Status žiadanky` = '#&@'";
|
|
if (checkBox65.Checked == true) strCheckBox = strCheckBox + " OR `Status žiadanky` = 'Prijatá'";
|
|
if (checkBox66.Checked == true) strCheckBox = strCheckBox + " OR `Status žiadanky` = 'Zamietnutá'";
|
|
if (checkBox67.Checked == true) strCheckBox = strCheckBox + " OR `Status žiadanky` = 'Schválená'";
|
|
if (checkBox68.Checked == true) strCheckBox = strCheckBox + " OR `Status žiadanky` = 'Dopyt odoslaný'";
|
|
if (checkBox69.Checked == true) strCheckBox = strCheckBox + " OR `Status žiadanky` = 'Objednávka odoslaná'";
|
|
if (checkBox70.Checked == true) strCheckBox = strCheckBox + " OR `Status žiadanky` = 'Potvrdená'";
|
|
if (checkBox71.Checked == true) strCheckBox = strCheckBox + " OR `Status žiadanky` = 'Tovar doručený'";
|
|
if (checkBox72.Checked == true) strCheckBox = strCheckBox + " OR `Status žiadanky` = 'Vybavená'";
|
|
if (checkBox73.Checked == true) strCheckBox = strCheckBox + " OR `Status žiadanky` = 'Nevybavená'";
|
|
|
|
if (strCommandZiadankyWhere == "") strCommandZiadankyWhere = "WHERE " + strCheckBox + ")";
|
|
else strCommandZiadankyWhere = strCommandZiadankyWhere + " AND " + strCheckBox + ")";
|
|
|
|
sqlCommandZiadanky = @"SELECT * FROM `pohlad-ziadanka` " + strCommandZiadankyWhere + strTextBoxCondition + " ORDER BY `IDZiadanka` DESC;";
|
|
|
|
DataTable outdtbl = new DataTable();
|
|
//Int32 StartRecord = (Convert.ToInt32(numericUpDown23.Value) * classSQL.intPocetNaStranu) - classSQL.intPocetNaStranu;
|
|
classSQL.SQL(sqlCommandZiadanky, out outdtbl);
|
|
dataGridView16.DataSource = outdtbl;
|
|
|
|
SelectPreviousSelection();
|
|
ReloadSelected = true;
|
|
|
|
//if (dataGridView16.Rows.Count != 0)
|
|
// if (selectedIndex <= dataGridView16.Rows.Count - 1) dataGridView16.Rows[selectedIndex].Selected = true;
|
|
// else if ((selectedIndex - 1) >= dataGridView16.Rows.Count) dataGridView16.Rows[dataGridView16.Rows.Count - 1].Selected = true;
|
|
// else dataGridView16.Rows[selectedIndex - 1].Selected = true;
|
|
|
|
/*
|
|
Int32 PocetStran = Convert.ToInt32(Math.Ceiling((double)classSQL.intCelkovyPocetZazanmov / classSQL.intPocetNaStranu));
|
|
label65.Text = numericUpDown23.Value.ToString() + "/" + PocetStran.ToString();
|
|
if (PocetStran < 1) PocetStran = 1;
|
|
numericUpDown23.Maximum = PocetStran;
|
|
|
|
dataGVSetColumnSortMode(dataGridView14, DataGridViewColumnSortMode.NotSortable);
|
|
setDGV(dataGridView14, classUser.IndexPoziadavka);
|
|
//dataGridView14.Visible = true;
|
|
|
|
|
|
*/
|
|
lblZobrazenyPocet.Text = classSQL.intCelkovyPocetZazanmov.ToString();
|
|
|
|
}
|
|
|
|
private void SelectPreviousSelection()
|
|
{
|
|
if (SelectedIds != string.Empty)
|
|
{
|
|
var existingRows = dataGridView16.Rows.Cast<DataGridViewRow>().Where(x => SelectedIds.Contains(x.Cells["IDZiadanka"].Value.ToString())).ToList();
|
|
var existingIds = existingRows.Select(x => x.Index).ToList();
|
|
foreach (var id in existingIds)
|
|
{
|
|
dataGridView16.Rows[id].Selected = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void button127_Click(object sender, EventArgs e)
|
|
{
|
|
dataGridView16.MultiSelect = !dataGridView16.MultiSelect;
|
|
button127.Text = "Multiselect: " + dataGridView16.MultiSelect.ToString();
|
|
if (dataGridView16.MultiSelect == true) button127.BackColor = Color.PaleGreen;
|
|
else button127.BackColor = Color.Transparent;
|
|
}
|
|
|
|
private void button128_Click(object sender, EventArgs e)
|
|
{
|
|
Form frmEditPoziadanka2 = new frmEditPoziadavka(Convert.ToInt32(dataGridView16.SelectedRows[0].Cells["IDZiadanka"].Value));
|
|
frmEditPoziadanka2.ShowDialog();
|
|
refreshZiadanky();
|
|
}
|
|
private List<string> GetIds()
|
|
{
|
|
return dataGridView16.SelectedRows.Cast<DataGridViewRow>().Select(x => x.Cells["IDZiadanka"].Value.ToString()).ToList();
|
|
}
|
|
|
|
private void button129_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView16.SelectedRows.Count > 0)
|
|
{
|
|
//var ids = String.Join(", ", GetIds());
|
|
string cmd = $"UPDATE `mip`.`tabziadanka` SET `Status` = 'false' WHERE `IDZiadanka` IN ({SelectedIds});";
|
|
classSQL.SQL(cmd);
|
|
refreshZiadanky();
|
|
}
|
|
}
|
|
|
|
|
|
private void button123_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView16.SelectedRows.Count > 0)
|
|
{
|
|
string cmd = $@"UPDATE `mip`.`tabziadanka` SET `Status žiadanky` = 'Schválená', `Schválil(a)` = '{classUser.Titul} {classUser.Priezvisko} {classUser.Meno}', `Dátum schválenia` = DATE(NOW()) WHERE `IDZiadanka` IN ({SelectedIds});";
|
|
classSQL.SQL(cmd);
|
|
refreshZiadanky();
|
|
}
|
|
}
|
|
|
|
private void button124_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView16.SelectedRows.Count > 0)
|
|
{
|
|
string cmd = $@"UPDATE `mip`.`tabziadanka` SET `Status žiadanky` = 'Zamietnutá', `Schválil(a)` = '{classUser.Titul} {classUser.Priezvisko} {classUser.Meno}', `Dátum schválenia` = DATE(NOW()) WHERE `IDZiadanka` IN ({SelectedIds});";
|
|
classSQL.SQL(cmd);
|
|
refreshZiadanky();
|
|
}
|
|
}
|
|
|
|
private void button126_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView16.SelectedRows.Count > 0)
|
|
{
|
|
string cmd = $@"UPDATE `mip`.`tabziadanka`
|
|
SET `Status žiadanky` = 'Vybavená',
|
|
`Dátum vybavenia` = DATE(NOW())
|
|
WHERE `IDZiadanka` IN ({SelectedIds});";
|
|
classSQL.SQL(cmd);
|
|
refreshZiadanky();
|
|
}
|
|
}
|
|
|
|
private void button125_Click_1(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView16.SelectedRows.Count > 0)
|
|
{
|
|
string cmd = $@"UPDATE `mip`.`tabziadanka`
|
|
SET `Status žiadanky` = 'Nevybavená',
|
|
`Dátum vybavenia` = DATE(NOW())
|
|
WHERE `IDZiadanka` IN ({SelectedIds});";
|
|
classSQL.SQL(cmd);
|
|
refreshZiadanky();
|
|
}
|
|
}
|
|
|
|
private void button135_Click(object sender, EventArgs e)
|
|
{
|
|
byte[] FileData = null;
|
|
string cmd = "";
|
|
if (dataGridView16.SelectedRows.Count > 0)
|
|
{
|
|
cmd = "SELECT `NakresData` FROM `tabziadankanakres` WHERE IDZiadanka = " + dataGridView16.SelectedRows[0].Cells["IDZiadanka"].Value.ToString() + ";";
|
|
classSQL.SQL(cmd, out FileData);
|
|
}
|
|
|
|
|
|
if (FileData != null)
|
|
{
|
|
Form showVykres = new frmShowVykres(FileData);
|
|
showVykres.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("K tejto žiadanke nebol priradený nákres!");
|
|
}
|
|
|
|
refreshZiadanky();
|
|
}
|
|
|
|
private void tabPage15_Enter(object sender, EventArgs e)
|
|
{
|
|
|
|
|
|
string sqlCommandNastroje = "SELECT * FROM `pohladnastroje-zoznam`;";
|
|
|
|
DataTable tblnastroje = new DataTable();
|
|
classSQL.SQL(sqlCommandNastroje, out tblnastroje);
|
|
dataGridView17.DataSource = tblnastroje;
|
|
|
|
dataGVSetColumnSortMode(dataGridView17, DataGridViewColumnSortMode.NotSortable);
|
|
|
|
|
|
}
|
|
|
|
private void label104_Click(object sender, EventArgs e)
|
|
{
|
|
foreach (Control cntrl in label104.Parent.Controls) if (cntrl.Name != "label104") cntrl.Enabled = !cntrl.Enabled;
|
|
if (label104.BackColor == Color.DarkGray) { label104.BackColor = Color.PaleGreen; label104.Text = "Filter zapnutý"; }
|
|
else { label104.BackColor = Color.DarkGray; label104.Text = "Filter vypnutý"; }
|
|
}
|
|
|
|
private void label77_Click(object sender, EventArgs e)
|
|
{
|
|
if (label77.BackColor == Color.DarkGray) { label77.BackColor = Color.PaleGreen; label77.Text = "Multiselect zapnutý"; dataGridView17.MultiSelect = true; }
|
|
else { label77.BackColor = Color.DarkGray; label77.Text = "Multiselect vypnutý"; dataGridView17.MultiSelect = false; }
|
|
}
|
|
|
|
DataTable tabSpecifikaciaMain = new DataTable();
|
|
private void dataGridView17_RowEnter(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
|
|
DataGridViewRow dr = new DataGridViewRow();
|
|
dr = dataGridView17.Rows[e.RowIndex];
|
|
label66.Text = dr.Cells["IDNástroj"].Value.ToString();
|
|
label90.Text = Convert.ToDateTime(dr.Cells["Dátum zaradenia"].Value).ToString("yyyy.MM.dd");
|
|
label88.Text = dr.Cells["Status"].Value.ToString();
|
|
label82.Text = dr.Cells["Poradové číslo"].Value.ToString();
|
|
label78.Text = dr.Cells["Kategória"].Value.ToString();
|
|
label80.Text = dr.Cells["Výrobné číslo"].Value.ToString();
|
|
label100.Text = dr.Cells["Poznámka"].Value.ToString();
|
|
label96.Text = dr.Cells["Dôvod vyradenia"].Value.ToString();
|
|
label94.Text = dr.Cells["Počet použití"].Value.ToString();
|
|
label92.Text = dr.Cells["Počet brúsení"].Value.ToString();
|
|
if (dr.Cells["Dátum vyradenia"].Value.ToString() != "") label98.Text = Convert.ToDateTime(dr.Cells["Dátum vyradenia"].Value).ToString("yyyy.MM.dd");
|
|
|
|
flowLayoutPanel2.Controls.Clear();
|
|
flowLayoutPanel3.Controls.Clear();
|
|
|
|
DataTable specMariaDB;
|
|
string cmd = "select * from `tabnastroje-spec` where `IDNástrojSpec` = " + dr.Cells["IDNástroj"].Value.ToString() + ";";
|
|
classSQL.SQL(cmd, out specMariaDB);
|
|
|
|
foreach (DataRow dtr in specMariaDB.Rows)
|
|
{
|
|
//MessageBox.Show(dtr.Field<Int32>("Brúsiteľný").ToString());
|
|
|
|
specifikaciaMain(dtr.Field<Int32>("IDSpec"), dtr.Field<string>("Názov špecifikácie"), dtr.Field<string>("Dáta špecifikácie"), Convert.ToBoolean(dtr.Field<Int32>("Brúsiteľný")));
|
|
DataRow dr2 = tabSpecifikaciaMain.NewRow();
|
|
dr2["IDSpec"] = dtr.Field<Int32>("IDSpec");
|
|
dr2["Názov špecifikácie"] = dtr.Field<string>("Názov špecifikácie");
|
|
dr2["Dáta špecifikácie"] = dtr.Field<string>("Dáta špecifikácie");
|
|
dr2["Brúsiteľný"] = Convert.ToBoolean(dtr.Field<Int32>("Brúsiteľný"));
|
|
dr2["Vymazaný"] = false;
|
|
tabSpecifikaciaMain.Rows.Add(dr2);
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
public void specifikaciaMain(Int32 _IDSpec, string _NazovSpec, string _DataSpec, bool _Brusitelny)
|
|
{
|
|
if (_Brusitelny == false)
|
|
{
|
|
FlowLayoutPanel panelSpecifikacia = new FlowLayoutPanel();
|
|
panelSpecifikacia.Name = tabSpecifikaciaMain.Rows.Count.ToString();
|
|
panelSpecifikacia.Tag = _IDSpec.ToString();
|
|
panelSpecifikacia.Size = new System.Drawing.Size(20, 12);
|
|
panelSpecifikacia.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
panelSpecifikacia.Margin = new Padding(1, 1, 1, 1);
|
|
panelSpecifikacia.AutoSize = true;
|
|
|
|
Label labelSpecifikaciaNazov = new Label();
|
|
labelSpecifikaciaNazov.Name = "Názov špecifikácie";
|
|
labelSpecifikaciaNazov.Text = _NazovSpec;
|
|
labelSpecifikaciaNazov.Margin = new Padding(1, 1, 1, 1);
|
|
labelSpecifikaciaNazov.AutoSize = true;
|
|
labelSpecifikaciaNazov.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
labelSpecifikaciaNazov.TextAlign = ContentAlignment.TopCenter;
|
|
labelSpecifikaciaNazov.TabIndex = 6;
|
|
panelSpecifikacia.Controls.Add(labelSpecifikaciaNazov);
|
|
|
|
Label labelSpecifikaciaData = new Label();
|
|
labelSpecifikaciaData.Name = "Dáta špecifikácie";
|
|
labelSpecifikaciaData.Text = _DataSpec;
|
|
labelSpecifikaciaData.Margin = new Padding(1, 1, 1, 1);
|
|
labelSpecifikaciaData.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
labelSpecifikaciaData.TextAlign = ContentAlignment.TopCenter;
|
|
labelSpecifikaciaData.AutoSize = true;
|
|
labelSpecifikaciaData.TabIndex = 6;
|
|
panelSpecifikacia.Controls.Add(labelSpecifikaciaData);
|
|
|
|
flowLayoutPanel2.Controls.Add(panelSpecifikacia);
|
|
}
|
|
else
|
|
{
|
|
FlowLayoutPanel panelSpecifikacia = new FlowLayoutPanel();
|
|
panelSpecifikacia.Name = tabSpecifikaciaMain.Rows.Count.ToString();
|
|
panelSpecifikacia.Tag = _IDSpec.ToString();
|
|
panelSpecifikacia.Size = new System.Drawing.Size(20, 12);
|
|
panelSpecifikacia.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
panelSpecifikacia.Margin = new Padding(1, 1, 1, 1);
|
|
panelSpecifikacia.AutoSize = true;
|
|
|
|
Label labelSpecifikaciaNazov = new Label();
|
|
labelSpecifikaciaNazov.Name = "Názov špecifikácie";
|
|
labelSpecifikaciaNazov.Text = _NazovSpec;
|
|
labelSpecifikaciaNazov.Margin = new Padding(1, 1, 1, 1);
|
|
labelSpecifikaciaNazov.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
labelSpecifikaciaNazov.AutoSize = true;
|
|
labelSpecifikaciaNazov.TabIndex = 6;
|
|
panelSpecifikacia.Controls.Add(labelSpecifikaciaNazov);
|
|
|
|
NumericUpDown nudSpecifikacia = new NumericUpDown();
|
|
nudSpecifikacia.AutoSize = true;
|
|
nudSpecifikacia.DecimalPlaces = 3;
|
|
nudSpecifikacia.Name = "Dáta špecifikácie";
|
|
nudSpecifikacia.Value = Convert.ToInt32(_DataSpec);
|
|
nudSpecifikacia.Tag = Convert.ToInt32(_DataSpec);
|
|
nudSpecifikacia.Maximum = 9999;
|
|
nudSpecifikacia.Margin = new Padding(1, 1, 1, 1);
|
|
panelSpecifikacia.Controls.Add(nudSpecifikacia);
|
|
|
|
flowLayoutPanel3.Controls.Add(panelSpecifikacia);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
private void button138_Click(object sender, EventArgs e)
|
|
{
|
|
frmPridatEditovatNastroj frmPridatEditovatNastroj2 = new frmPridatEditovatNastroj(null);
|
|
frmPridatEditovatNastroj2.ShowDialog();
|
|
}
|
|
|
|
private void button137_Click(object sender, EventArgs e)
|
|
{
|
|
frmPridatEditovatNastroj frmPridatEditovatNastroj2 = new frmPridatEditovatNastroj(dataGridView17.SelectedRows[0]);
|
|
frmPridatEditovatNastroj2.ShowDialog();
|
|
}
|
|
|
|
private void button70_Click(object sender, EventArgs e)
|
|
{
|
|
string strUdrzbaTXT = " `IDUdrzba`,";
|
|
string strUdrzbaValue = "";
|
|
|
|
if (comboBox15.Text != "" & comboBox15.Enabled == true)
|
|
{
|
|
strUdrzbaValue = comboBox15.SelectedValue.ToString();
|
|
strUdrzbaTXT = " `IDUdrzba`,";
|
|
}
|
|
else
|
|
{
|
|
strUdrzbaValue = "";
|
|
strUdrzbaTXT = "";
|
|
}
|
|
|
|
var strCenaValue = textBox21.Text == string.Empty ? "null" : $"'{textBox21.Text.Replace(",", ".")}'";
|
|
|
|
string cmd;
|
|
string format = "yyyy-MM-dd";
|
|
|
|
if (button70.Text == "Pridať opravu")
|
|
{
|
|
cmd = $@"INSERT INTO `mip`.`tabudrzbyaopravy` (`Datum`, `Operacia`,{strUdrzbaTXT} `IDStroja`, `NazovFirmy`, `CasZacatia`, `CasUkoncenia`, `Cena`, `Poznamka`, `CisloDokladu`)
|
|
VALUES ( DATE(NOW()),
|
|
'{comboBox5.Text}',
|
|
'{strUdrzbaValue}',
|
|
{comboBox6.SelectedValue.ToString()},
|
|
'{comboBox7.Text}',
|
|
'{dateTimePicker5.Value.ToString(format)} {numericUpDown22.Value.ToString()}:{numericUpDown21.Value.ToString()}:00',
|
|
'{dateTimePicker2.Value.ToString(format)} {numericUpDown17.Value.ToString()}:{numericUpDown18.Value.ToString()}:00',
|
|
{strCenaValue},
|
|
'{textBox20.Text}',
|
|
'{textBox3.Text}');";
|
|
|
|
classSQL.SQL(cmd);
|
|
panelPridatUdrzbu.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
strUdrzbaTXT = strUdrzbaTXT == string.Empty ? string.Empty : strUdrzbaTXT.Replace(",", "");
|
|
|
|
cmd = $@"UPDATE `mip`.`tabudrzbyaopravy` SET
|
|
`Operacia` = '{comboBox5.Text}',
|
|
{strUdrzbaTXT} = '{strUdrzbaValue}',
|
|
`IDStroja` = {comboBox6.SelectedValue.ToString()},
|
|
`NazovFirmy` = '{comboBox7.Text}',
|
|
`CasZacatia` = '{dateTimePicker5.Value.ToString(format)} {numericUpDown22.Value.ToString()}:{numericUpDown21.Value.ToString()}:00',
|
|
`CasUkoncenia` = '{dateTimePicker2.Value.ToString(format)} {numericUpDown17.Value.ToString()}:{numericUpDown18.Value.ToString()}:00',
|
|
`Cena` = {strCenaValue},
|
|
`Poznamka` = '{textBox20.Text}',
|
|
`CisloDokladu` = '{textBox3.Text}'
|
|
WHERE `IDPUOPR` = {button70.Tag.ToString()};";
|
|
|
|
classSQL.SQL(cmd);
|
|
panelPridatUdrzbu.Visible = false;
|
|
}
|
|
refreshUdrzby();
|
|
}
|
|
|
|
private void panelPridatUdrzbu_VisibleChanged(object sender, EventArgs e)
|
|
{
|
|
if (panelPridatUdrzbu.Visible == true)
|
|
{
|
|
panelPridatUdrzbu.Location = new Point(196, 36);
|
|
panel56.Visible = false;
|
|
|
|
button70.Enabled = false;
|
|
|
|
comboBox8.Items.Clear();
|
|
comboBox6.Items.Clear();
|
|
comboBox5.Items.Clear();
|
|
comboBox7.Items.Clear();
|
|
comboBox15.DataSource = null;
|
|
comboBox15.Items.Clear();
|
|
textBox21.Text = "";
|
|
textBox20.Text = "";
|
|
textBox3.Text = "";
|
|
classGlobal.FillCB(comboBox8, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať dieľňu");
|
|
classGlobal.FillCB(comboBox5, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať operáciu");
|
|
classGlobal.FillCB(comboBox7, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať firmu");
|
|
|
|
comboBox8.Focus();
|
|
|
|
}
|
|
else panelPridatUdrzbu.Location = new Point(300, 248);
|
|
}
|
|
|
|
private void panel56_VisibleChanged(object sender, EventArgs e)
|
|
{
|
|
if (panel56.Visible == true)
|
|
{
|
|
panel56.Location = new Point(3, 36);
|
|
panelPridatUdrzbu.Visible = false;
|
|
|
|
button147.Enabled = false;
|
|
|
|
comboBox11.Items.Clear();
|
|
//comboBox14.Items.Clear();
|
|
comboBox14.DataSource = null;
|
|
comboBox12.Items.Clear();
|
|
textBox37.Text = "";
|
|
classGlobal.FillCB(comboBox11, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať dieľňu");
|
|
classGlobal.FillCB(comboBox12, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať operáciu");
|
|
comboBox11.Focus();
|
|
}
|
|
else
|
|
{
|
|
panel56.Location = new Point(3, 300);
|
|
|
|
label109.Enabled = true;
|
|
comboBox11.Enabled = true;
|
|
label117.Enabled = false;
|
|
comboBox14.Enabled = false;
|
|
label107.Enabled = false;
|
|
comboBox12.Enabled = false;
|
|
button146.Enabled = false;
|
|
label111.Enabled = false;
|
|
dateTimePicker3.Enabled = false;
|
|
numericUpDown27.Enabled = false;
|
|
numericUpDown26.Enabled = false;
|
|
|
|
label114.Enabled = false;
|
|
dateTimePicker4.Enabled = false;
|
|
numericUpDown29.Enabled = false;
|
|
numericUpDown28.Enabled = false;
|
|
label112.Enabled = false;
|
|
textBox37.Enabled = false;
|
|
button147.Enabled = false;
|
|
}
|
|
|
|
}
|
|
|
|
private void button144_Click(object sender, EventArgs e)
|
|
{
|
|
if (panel56.Visible == false)
|
|
{
|
|
panel56.Visible = true;
|
|
button147.Text = "Zahájiť odstávku";
|
|
}
|
|
else panel56.Visible = false;
|
|
}
|
|
|
|
private void panel56_Leave(object sender, EventArgs e)
|
|
{
|
|
panel56.Visible = false;
|
|
}
|
|
|
|
private void tabPage11_Enter_1(object sender, EventArgs e)
|
|
{
|
|
refreshUdrzby();
|
|
}
|
|
|
|
private void refreshUdrzby()
|
|
{
|
|
string cmd;
|
|
DataTable tabUdrzby = new DataTable();
|
|
cmd = "select * from `pohladudrzby` ORDER BY `Datum` desc;";
|
|
classSQL.SQL(cmd, out tabUdrzby);
|
|
dataGridView8.DataSource = tabUdrzby;
|
|
|
|
formatDGVUdrzby();
|
|
}
|
|
|
|
private void formatDGVUdrzby()
|
|
{
|
|
dataGridView8.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
|
dataGridView8.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
|
|
dataGridView8.Columns["IDStroj"].Visible = false;
|
|
dataGridView8.Columns["IDUdrzba"].Visible = false;
|
|
dataGridView8.Columns["IDPUOPR"].Visible = false;
|
|
}
|
|
|
|
private void button148_Click(object sender, EventArgs e)
|
|
{
|
|
panel56.Visible = false;
|
|
|
|
}
|
|
|
|
private void button149_Click(object sender, EventArgs e)
|
|
{
|
|
panelPridatUdrzbu.Visible = false;
|
|
}
|
|
|
|
private void comboBox11_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
comboBox14.DataSource = null;
|
|
comboBox14.Items.Clear();
|
|
string cmd = "SELECT CONCAT (`Vyrobca`, ' - ', `ModelStroja`) AS `Stroj`, `IDStroj` FROM `mip`.tabstroje WHERE `Dielna` = '" + comboBox11.Text + "';";
|
|
DataTable tblStroje = new DataTable();
|
|
classSQL.SQL(cmd, out tblStroje);
|
|
comboBox14.DataSource = tblStroje;
|
|
comboBox14.ValueMember = "IDStroj";
|
|
comboBox14.DisplayMember = "Stroj";
|
|
comboBox14.SelectedIndex = -1;
|
|
comboBox14.Enabled = true;
|
|
if (comboBox11.Text == "") comboBox14.Enabled = false;
|
|
label117.Enabled = true;
|
|
}
|
|
|
|
private void comboBox14_SelectedValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (comboBox14.Text != "") { comboBox12.Enabled = true; button146.Enabled = true; label107.Enabled = true; }
|
|
else { comboBox12.Enabled = false; button146.Enabled = false; label107.Enabled = false; }
|
|
}
|
|
|
|
private void comboBox12_SelectedValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["CasUkoncenia"].Value.ToString() == "")
|
|
//if (comboBox12.Text != "")
|
|
{
|
|
label109.Enabled = false;
|
|
comboBox11.Enabled = false;
|
|
label117.Enabled = false;
|
|
comboBox14.Enabled = false;
|
|
label107.Enabled = false;
|
|
comboBox12.Enabled = false;
|
|
button146.Enabled = false;
|
|
label111.Enabled = false;
|
|
comboBox13.Enabled = false;
|
|
label108.Enabled = false;
|
|
dateTimePicker3.Enabled = false;
|
|
numericUpDown27.Enabled = false;
|
|
numericUpDown26.Enabled = false;
|
|
|
|
label114.Enabled = true;
|
|
dateTimePicker4.Enabled = true;
|
|
numericUpDown29.Enabled = true;
|
|
numericUpDown28.Enabled = true;
|
|
label112.Enabled = true;
|
|
textBox37.Enabled = true;
|
|
button147.Enabled = true;
|
|
|
|
}
|
|
else
|
|
{
|
|
label109.Enabled = true;
|
|
comboBox11.Enabled = true;
|
|
label117.Enabled = true;
|
|
comboBox14.Enabled = true;
|
|
label107.Enabled = true;
|
|
comboBox12.Enabled = true;
|
|
button146.Enabled = true;
|
|
label111.Enabled = true;
|
|
if (comboBox12.Text == "Plánovaná údržba")
|
|
{
|
|
comboBox13.DataSource = null;
|
|
comboBox13.Items.Clear();
|
|
string cmd = "select `popisPU`, `IDUdrzba` from `tabudrzba` where IDstroja =" + comboBox14.SelectedValue.ToString() + ";";
|
|
DataTable tblPU = new DataTable();
|
|
classSQL.SQL(cmd, out tblPU);
|
|
comboBox13.DataSource = tblPU;
|
|
comboBox13.ValueMember = "IDUdrzba";
|
|
comboBox13.DisplayMember = "popisPU";
|
|
comboBox13.SelectedIndex = -1;
|
|
comboBox13.Enabled = true;
|
|
label108.Enabled = true;
|
|
}
|
|
else { comboBox13.DataSource = null; comboBox13.Items.Clear(); comboBox13.Enabled = false; label108.Enabled = false; }
|
|
|
|
dateTimePicker3.Enabled = true;
|
|
numericUpDown27.Enabled = true;
|
|
numericUpDown26.Enabled = true;
|
|
|
|
label114.Enabled = false;
|
|
dateTimePicker4.Enabled = false;
|
|
numericUpDown29.Enabled = false;
|
|
numericUpDown28.Enabled = false;
|
|
label112.Enabled = true;
|
|
textBox37.Enabled = true;
|
|
button147.Enabled = true;
|
|
}
|
|
}
|
|
|
|
private void button145_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["CasUkoncenia"].Value.ToString() == "")
|
|
//if (panel56.Visible == false)
|
|
{
|
|
DateTime dt = Convert.ToDateTime(dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["CasZacatia"].Value);
|
|
|
|
panel56.Visible = true;
|
|
comboBox11.Text = dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["Dielna"].Value.ToString();
|
|
comboBox14.Text = dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["Stroj"].Value.ToString();
|
|
comboBox12.Text = dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["Operacia"].Value.ToString();
|
|
textBox37.Text = dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["Poznamka"].Value.ToString();
|
|
dateTimePicker3.Value = dt.Date;
|
|
numericUpDown27.Value = dt.Hour;
|
|
numericUpDown26.Value = dt.Minute;
|
|
dateTimePicker4.Value = DateTime.Now.Date;
|
|
numericUpDown29.Value = DateTime.Now.Hour;
|
|
numericUpDown28.Value = DateTime.Now.Minute;
|
|
button147.Text = "Ukončiť odstávku";
|
|
button147.Tag = dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["IDPUOPR"].Value.ToString();
|
|
}
|
|
|
|
else
|
|
{
|
|
panel56.Visible = false;
|
|
MessageBox.Show("Odstávka je už ukončená!");
|
|
}
|
|
}
|
|
|
|
private void button147_Click(object sender, EventArgs e)
|
|
{
|
|
string cmd = "";
|
|
string format = "yyyy-MM-dd";
|
|
|
|
switch (button147.Text)
|
|
{
|
|
case "Zahájiť odstávku":
|
|
string strUdrzbaTXT = " `IDUdrzba`,";
|
|
string strUdrzbaValue = "";
|
|
|
|
if (comboBox13.Text != "" & comboBox13.Enabled == true)
|
|
{
|
|
strUdrzbaValue = comboBox13.SelectedValue.ToString() + ", ";
|
|
strUdrzbaTXT = " `IDUdrzba`,";
|
|
}
|
|
else
|
|
{
|
|
strUdrzbaValue = "";
|
|
strUdrzbaTXT = "";
|
|
}
|
|
|
|
|
|
cmd = @"insert into `mip`.`tabudrzbyaopravy` (`Datum`, `Operacia`," + strUdrzbaTXT + @" `IDStroja`, `CasZacatia`, `Poznamka`)
|
|
VALUES("
|
|
+ "DATE(NOW()), '"
|
|
+ comboBox12.Text + "', "
|
|
+ strUdrzbaValue
|
|
+ comboBox14.SelectedValue.ToString() + ", '"
|
|
+ dateTimePicker3.Value.ToString(format) + " " + numericUpDown27.Value.ToString() + ":" + numericUpDown26.Value.ToString() + ":00', '"
|
|
+ textBox37.Text + "');";
|
|
|
|
classSQL.SQL(cmd);
|
|
break;
|
|
|
|
case "Ukončiť odstávku":
|
|
cmd = @"UPDATE `mip`.`tabudrzbyaopravy` SET `CasUkoncenia` = '"
|
|
+ dateTimePicker4.Value.ToString(format) + " " + numericUpDown29.Value.ToString() + ":" + numericUpDown28.Value.ToString() + @":00',
|
|
`Poznamka` = '" + textBox37.Text +
|
|
"' WHERE `IDPUOPR`= " + button147.Tag + ";";
|
|
classSQL.SQL(cmd);
|
|
break;
|
|
}
|
|
panel56.Visible = false;
|
|
refreshUdrzby();
|
|
}
|
|
|
|
private void toolStripStatusLabel6_Click(object sender, EventArgs e)
|
|
{
|
|
if (flowLayoutPanel4.Visible == false) { flowLayoutPanel4.Visible = true; toolStripStatusLabel6.BackColor = Color.LightGreen; toolStripStatusLabel6.BorderSides = ToolStripStatusLabelBorderSides.All; }
|
|
else { flowLayoutPanel4.Visible = false; toolStripStatusLabel6.BackColor = Color.Empty; toolStripStatusLabel6.BorderSides = ToolStripStatusLabelBorderSides.None; }
|
|
}
|
|
|
|
void strojeLoad(object sender, EventArgs e)
|
|
{
|
|
ComboBox cbn = new ComboBox();
|
|
cbn = sender as ComboBox;
|
|
DataTable tbl = new DataTable();
|
|
|
|
for (int i = flowLayoutPanel4.Controls.Count - 1; i >= 0; i--) if (flowLayoutPanel4.Controls[i] is FlowLayoutPanel) flowLayoutPanel4.Controls[i].Dispose();
|
|
|
|
string cmd = "select * from `pohladudrzbyplanovanie` where `IDStroja` = " + cbn.SelectedValue.ToString() + ";";
|
|
classSQL.SQL(cmd, out tbl);
|
|
|
|
foreach (DataRow dr in tbl.Rows)
|
|
{
|
|
FlowLayoutPanel panelS = new FlowLayoutPanel();
|
|
panelS.Name = dr["IDUdrzba"].ToString();
|
|
panelS.Size = new System.Drawing.Size(20, 12);
|
|
panelS.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
panelS.Margin = new Padding(1, 1, 1, 1);
|
|
panelS.AutoSize = true;
|
|
|
|
Label labelPerioda = new Label();
|
|
labelPerioda.Text = dr["Perióda plánovanej údržby"].ToString();
|
|
labelPerioda.Margin = new Padding(1, 1, 0, 1);
|
|
labelPerioda.Size = new System.Drawing.Size(65, 15);
|
|
labelPerioda.TextAlign = ContentAlignment.MiddleCenter;
|
|
labelPerioda.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
//labelPerioda.AutoSize = true;
|
|
panelS.Controls.Add(labelPerioda);
|
|
|
|
Label labelPocet = new Label();
|
|
string strden;
|
|
switch (dr["Počet dní do ďaľšej údržby"].ToString())
|
|
{
|
|
case "1":
|
|
strden = " deň";
|
|
break;
|
|
case "2":
|
|
strden = " dni";
|
|
break;
|
|
case "3":
|
|
strden = " dni";
|
|
break;
|
|
case "4":
|
|
strden = " dni";
|
|
break;
|
|
default:
|
|
strden = " dní";
|
|
break;
|
|
}
|
|
labelPocet.Text = "za " + dr["Počet dní do ďaľšej údržby"].ToString() + strden;
|
|
labelPocet.Tag = dr["Počet dní do ďaľšej údržby"];
|
|
labelPocet.Margin = new Padding(1, 1, 0, 1);
|
|
labelPocet.Size = new System.Drawing.Size(65, 15);
|
|
//labelPocet.AutoSize = true;
|
|
labelPocet.TextAlign = ContentAlignment.MiddleCenter;
|
|
labelPocet.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
panelS.Controls.Add(labelPocet);
|
|
|
|
Label labelUdrzba = new Label();
|
|
labelUdrzba.Text = dr["Popis plánovanej údržby"].ToString();
|
|
labelUdrzba.Margin = new Padding(1, 1, 1, 1);
|
|
labelUdrzba.Size = new System.Drawing.Size(20, 15);
|
|
labelUdrzba.AutoSize = true;
|
|
labelUdrzba.Anchor = AnchorStyles.Right | AnchorStyles.Left;
|
|
labelUdrzba.TextAlign = ContentAlignment.MiddleCenter;
|
|
labelUdrzba.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
panelS.Controls.Add(labelUdrzba);
|
|
|
|
Color clr = Color.LightGreen;
|
|
|
|
switch (dr["Perióda plánovanej údržby"].ToString())
|
|
{
|
|
case "Týždenne":
|
|
int d = Convert.ToInt32(labelPocet.Tag);
|
|
if (d < 1) clr = Color.Red;
|
|
if (d == 1) clr = Color.Coral;
|
|
if (d == 2) clr = Color.LightYellow;
|
|
break;
|
|
case "Mesačne":
|
|
int d1 = Convert.ToInt32(labelPocet.Tag);
|
|
if (d1 < 1) clr = Color.Red;
|
|
if (d1 >= 1 && d1 < 7) clr = Color.Coral;
|
|
if (d1 >= 7 && d1 < 14) clr = Color.LightYellow;
|
|
break;
|
|
case "Štvrťročne":
|
|
int d2 = Convert.ToInt32(labelPocet.Tag);
|
|
if (d2 < 1) clr = Color.Red;
|
|
if (d2 >= 1 && d2 < 7) clr = Color.Coral;
|
|
if (d2 >= 7 && d2 < 21) clr = Color.LightYellow;
|
|
break;
|
|
case "Ročne":
|
|
int d3 = Convert.ToInt32(labelPocet.Tag);
|
|
if (d3 < 1) clr = Color.Red;
|
|
if (d3 >= 1 && d3 < 14) clr = Color.Coral;
|
|
if (d3 >= 14 && d3 < 30) clr = Color.LightYellow;
|
|
break;
|
|
case "5-ročne":
|
|
int d4 = Convert.ToInt32(labelPocet.Tag);
|
|
if (d4 < 1) clr = Color.Red;
|
|
if (d4 >= 1 && d4 < 30) clr = Color.Coral;
|
|
if (d4 >= 30 && d4 < 90) clr = Color.LightYellow;
|
|
break;
|
|
}
|
|
labelUdrzba.BackColor = clr;
|
|
labelPerioda.BackColor = clr;
|
|
labelPocet.BackColor = clr;
|
|
|
|
|
|
flowLayoutPanel4.Controls.Add(panelS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void flowLayoutPanel4_VisibleChanged(object sender, EventArgs e)
|
|
{
|
|
if (flowLayoutPanel4.Visible == true)
|
|
{
|
|
flowLayoutPanel4.Controls.Clear();
|
|
Padding pad = new Padding(1, 1, 1, 1);
|
|
|
|
string cmd = "select * from `pohladstroje-zaradenie` where `iduser` = " + classUser.ID + ";";
|
|
DataTable tblStroje;
|
|
classSQL.SQL(cmd, out tblStroje);
|
|
|
|
Panel panel = new Panel();
|
|
panel.AutoSize = true;
|
|
panel.Margin = pad;
|
|
panel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
panel.Dock = DockStyle.Top;
|
|
|
|
ComboBox cb = new ComboBox();
|
|
cb.DataSource = tblStroje;
|
|
cb.ValueMember = "IDStrojZaradenie";
|
|
cb.DisplayMember = "Stroj";
|
|
cb.SelectedIndex = -1;
|
|
cb.Margin = pad;
|
|
cb.Location = new Point(1, 1);
|
|
cb.Size = new Size(panel.Size.Width - 2, panel.Size.Height - 2);
|
|
//cb.Anchor = AnchorStyles.Left | AnchorStyles.Right;
|
|
cb.SelectedValueChanged += new EventHandler(strojeLoad);
|
|
|
|
panel.Controls.Add(cb);
|
|
flowLayoutPanel4.Controls.Add(panel);
|
|
flowLayoutPanel4.BringToFront();
|
|
|
|
//MessageBox.Show(flowLayoutPanel4.Visible.ToString());
|
|
}
|
|
else flowLayoutPanel4.Controls.Clear();
|
|
}
|
|
|
|
private void button151_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
Form frmPrirZamestStroju = new frmPriraditZamestnancaStroju(Convert.ToInt32(dGVStroje.SelectedRows[0].Cells["IDStroj"].Value));
|
|
frmPrirZamestStroju.ShowDialog();
|
|
}
|
|
|
|
private void button152_Click(object sender, EventArgs e)
|
|
{
|
|
UpdateDate("Potvrdený dátum", sender);
|
|
}
|
|
|
|
private void button174_Click(object sender, EventArgs e)
|
|
{
|
|
UpdateDate("Dátum prijatia", sender);
|
|
|
|
}
|
|
|
|
private void UpdateDate(string _column, object sender)
|
|
{
|
|
Button bt = sender as Button;
|
|
bt.BackColor = Color.LightYellow;
|
|
panel57.Tag = _column;
|
|
if (panel57.Visible == false) panel57.Visible = true;
|
|
else panel57.Visible = false;
|
|
}
|
|
|
|
private void button154_Click(object sender, EventArgs e)
|
|
{
|
|
panel57.Visible = false;
|
|
|
|
}
|
|
|
|
private void button153_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView16.SelectedRows.Count > 0)
|
|
{
|
|
string strColumn = panel57.Tag.ToString();
|
|
string statusZiadanky = "";
|
|
if (strColumn == "Potvrdený dátum") statusZiadanky = "Potvrdená";
|
|
if (strColumn == "Dátum prijatia") statusZiadanky = "Tovar doručený";
|
|
string format = "yyyy-MM-dd";
|
|
|
|
string cmd = $@"UPDATE `mip`.`tabziadanka`
|
|
SET `Status žiadanky` = '{statusZiadanky}', `{strColumn}` = '{dateTimePicker6.Value.ToString(format)}' WHERE `IDZiadanka` IN ({SelectedIds});";
|
|
classSQL.SQL(cmd);
|
|
panel57.Visible = false;
|
|
refreshZiadanky();
|
|
}
|
|
}
|
|
|
|
private void panel57_VisibleChanged(object sender, EventArgs e)
|
|
{
|
|
if (panel57.Visible == false)
|
|
{
|
|
if (button174.BackColor == Color.LightYellow) button174.BackColor = System.Drawing.SystemColors.ControlLight;
|
|
if (button152.BackColor == Color.LightYellow) button152.BackColor = System.Drawing.SystemColors.ControlLight;
|
|
}
|
|
}
|
|
|
|
private void button157_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView16.SelectedRows.Count == 1)
|
|
{
|
|
if (panel61.Visible == false) panel61.Visible = true;
|
|
else panel61.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Cenu možno priradiť iba jednej objednávke!", "Upozornenie!");
|
|
}
|
|
}
|
|
|
|
private void button156_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView16.SelectedRows.Count == 1)
|
|
{
|
|
UpdateText("Faktúra", sender);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Faktúru možno priradiť iba jednej objednávke!", "Upozornenie!");
|
|
}
|
|
}
|
|
|
|
private void button175_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView16.SelectedRows.Count == 1)
|
|
{
|
|
UpdateText("Číslo objednávky", sender);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Číslo objednávky možno priradiť iba jednej objednávke!", "Upozornenie!");
|
|
}
|
|
}
|
|
|
|
private void UpdateText(string _column, object sender)
|
|
{
|
|
Button bt = sender as Button;
|
|
bt.BackColor = Color.LightYellow;
|
|
panel60.Tag = _column;
|
|
textBox12.Text = "";
|
|
if (panel60.Visible == false) panel60.Visible = true;
|
|
else panel60.Visible = false;
|
|
|
|
}
|
|
|
|
private void panel60_VisibleChanged(object sender, EventArgs e)
|
|
{
|
|
if (panel60.Visible == false)
|
|
{
|
|
if (button175.BackColor == Color.LightYellow) button175.BackColor = System.Drawing.SystemColors.ControlLight;
|
|
if (button156.BackColor == Color.LightYellow) button156.BackColor = System.Drawing.SystemColors.ControlLight;
|
|
}
|
|
}
|
|
|
|
private void button160_Click(object sender, EventArgs e)
|
|
{
|
|
panel61.Visible = false;
|
|
}
|
|
|
|
private void button158_Click(object sender, EventArgs e)
|
|
{
|
|
panel60.Visible = false;
|
|
}
|
|
|
|
private void button161_Click(object sender, EventArgs e)
|
|
{
|
|
string cmd = "UPDATE `mip`.`tabziadanka` SET `Cena` = '" + numericUpDown30.Value.ToString().Replace(",", ".") + "' WHERE `IDZiadanka` =" + dataGridView16.SelectedRows[0].Cells["IDZiadanka"].Value.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
panel61.Visible = false;
|
|
refreshZiadanky();
|
|
}
|
|
|
|
private void button159_Click(object sender, EventArgs e)
|
|
{
|
|
string strColumn = panel60.Tag.ToString();
|
|
string cmd = "UPDATE `mip`.`tabziadanka` SET `" + strColumn + "` = '" + textBox12.Text + "' WHERE `IDZiadanka` =" + dataGridView16.SelectedRows[0].Cells["IDZiadanka"].Value.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
panel60.Visible = false;
|
|
refreshZiadanky();
|
|
}
|
|
|
|
private void dataGridView7_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
dataGridView7.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView7.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
if (button101.Text == "Zobrazenie (max)")
|
|
{
|
|
if (dataGridView7.DataSource != null)
|
|
{
|
|
dataGridView7.Columns["Meno"].Visible = false;
|
|
dataGridView7.Columns["Alias"].Visible = false;
|
|
dataGridView7.Columns["Rozlišovací znak"].Visible = false;
|
|
dataGridView7.Columns["Počet segmentov"].Visible = false;
|
|
dataGridView7.Columns["Materiál č.3"].Visible = false;
|
|
dataGridView7.Columns["Materiál č.4"].Visible = false;
|
|
}
|
|
}
|
|
|
|
else
|
|
{
|
|
if (dataGridView7.DataSource != null)
|
|
{
|
|
dataGridView7.Columns["Meno"].Visible = true;
|
|
dataGridView7.Columns["Alias"].Visible = true;
|
|
dataGridView7.Columns["Rozlišovací znak"].Visible = true;
|
|
dataGridView7.Columns["Počet segmentov"].Visible = true;
|
|
dataGridView7.Columns["Materiál č.3"].Visible = true;
|
|
dataGridView7.Columns["Materiál č.4"].Visible = true;
|
|
}
|
|
}
|
|
classGlobal.RowColor(dataGridView7, NacenovanieColorIndex);
|
|
|
|
}
|
|
|
|
private void button101_Click(object sender, EventArgs e)
|
|
{
|
|
if (button101.Text == "Zobrazenie (max)") { button101.Text = "Zobrazenie (min)"; }
|
|
else { button101.Text = "Zobrazenie (max)"; }
|
|
refreshNacenovanie();
|
|
|
|
}
|
|
|
|
private void dataGridView7_DataSourceChanged(object sender, EventArgs e)
|
|
{
|
|
dataGridView7.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView7.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
dataGridView7.Columns["IDNacenovanie"].Visible = false;
|
|
dataGridView7.Columns["IDVyrobokNac"].Visible = false;
|
|
dataGridView7.Columns["Názov výrobku"].Width = 130;
|
|
dataGridView7.Columns["Zákazník"].Width = 120;
|
|
dataGridView7.Columns["Iný názov"].Width = 70;
|
|
dataGridView7.Columns["Status"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView7.Columns["Dátum prijatia"].Width = 120;
|
|
dataGridView7.Columns["Materiál č.1"].Width = 70;
|
|
dataGridView7.Columns["Materiál č.2"].Width = 70;
|
|
dataGridView7.Columns["Materiál č.3"].Width = 70;
|
|
dataGridView7.Columns["Materiál č.4"].Width = 70;
|
|
dataGridView7.Columns["Počet naceňovaných kusov"].Width = 80;
|
|
dataGridView7.Columns["Poznámka1"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
|
dataGridView7.Columns["Poznámka2"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
dataGridView7.Columns["Meno"].Width = 120;
|
|
dataGridView7.Columns["Alias"].Width = 70;
|
|
dataGridView7.Columns["Rozlišovací znak"].Width = 70;
|
|
dataGridView7.Columns["Počet segmentov"].Width = 70;
|
|
dataGridView7.Columns["Status vyhodnotenia"].Width = 120;
|
|
dataGridView7.Columns["IdVyhodnotenie"].Visible = false;
|
|
}
|
|
|
|
private void button162_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView7.SelectedRows.Count > 0)
|
|
{
|
|
Form frmNacenovanie2 = new frmNacenovanie(Convert.ToInt32(dataGridView7.SelectedRows[0].Cells["IDNacenovanie"].Value), Convert.ToInt32(dataGridView7.SelectedRows[0].Cells["IDVyrobokNac"].Value), true, false, true, true, true, true);
|
|
frmNacenovanie2.Text = "Print";
|
|
frmNacenovanie2.Visible = false;
|
|
frmNacenovanie2.Show();
|
|
|
|
}
|
|
}
|
|
|
|
private void button167_Click(object sender, EventArgs e)
|
|
{
|
|
panel62.Visible = false;
|
|
}
|
|
|
|
private void panel62_Leave(object sender, EventArgs e)
|
|
{
|
|
panel62.Visible = false;
|
|
}
|
|
|
|
private void button130_Click(object sender, EventArgs e)
|
|
{
|
|
var goodSelection = dataGridView16.SelectedRows.Cast<DataGridViewRow>().Select(x => x.Cells["IDFirma"].Value.ToString()).ToList().Distinct().Count() == 1;
|
|
|
|
label113.Text = "Exportovať XLSX";
|
|
if (panel62.Visible == false)
|
|
{
|
|
panel62.Visible = true;
|
|
panel62.Location = new Point(524, 62);
|
|
if (goodSelection)
|
|
{
|
|
button163.Visible = true;// slovensky dopyt
|
|
button164.Visible = false;// anglicky dopyt
|
|
button165.Visible = false;// slovenska objednavka
|
|
button166.Visible = false;// anglicka objednavka
|
|
label228.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
button163.Visible = false;// slovensky dopyt
|
|
button164.Visible = false;// anglicky dopyt
|
|
button165.Visible = false;// slovenska objednavka
|
|
button166.Visible = false;// anglicka objednavka
|
|
label228.Visible = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
panel62.Visible = false;
|
|
panel62.Location = new Point(524, 113);
|
|
}
|
|
}
|
|
|
|
private void button100_Click(object sender, EventArgs e)
|
|
{/*
|
|
string cmd = "select `Meno`, `Heslo` from `tabusers` where IDUsers = 1; ";
|
|
DataTable test = new DataTable();
|
|
|
|
classSQL.SQL(cmd, out test);
|
|
test.TableName = "test";
|
|
classGlobal.fillExcelForm(test);
|
|
*/
|
|
}
|
|
|
|
private void textBox32_TextChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
try
|
|
{
|
|
//this code is used to search Name on the basis of TextBox1.text
|
|
((DataTable)dataGridView11.DataSource).DefaultView.RowFilter = string.Format("Názovfirmy like '%{0}%'", textBox32.Text.Trim().Replace("'", "''"));
|
|
}
|
|
catch (Exception)
|
|
{
|
|
|
|
}
|
|
|
|
label115.Text = dataGridView11.Rows.Count.ToString();
|
|
}
|
|
|
|
private void button155_Click(object sender, EventArgs e)
|
|
{
|
|
label113.Text = "Tlačiť";
|
|
if (panel62.Visible == false)
|
|
{
|
|
panel62.Visible = true;
|
|
panel62.Location = new Point(524, 62);
|
|
}
|
|
else
|
|
{
|
|
panel62.Visible = false;
|
|
panel62.Location = new Point(524, 113);
|
|
}
|
|
}
|
|
|
|
private void textBox35_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshNacenovanie();
|
|
}
|
|
|
|
private void numericUpDown13_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
refreshNacenovanie();
|
|
}
|
|
|
|
private void checkBox59_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshNacenovanie();
|
|
}
|
|
|
|
private void checkBox58_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshNacenovanie();
|
|
}
|
|
|
|
private void checkBox57_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshNacenovanie();
|
|
}
|
|
|
|
private void checkBox56_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshNacenovanie();
|
|
}
|
|
|
|
private void button163_Click(object sender, EventArgs e)
|
|
{
|
|
TlacitFormular(sender);
|
|
}
|
|
|
|
private void button164_Click(object sender, EventArgs e)
|
|
{
|
|
TlacitFormular(sender);
|
|
}
|
|
|
|
private void button165_Click(object sender, EventArgs e)
|
|
{
|
|
TlacitFormular(sender);
|
|
}
|
|
|
|
private void button166_Click(object sender, EventArgs e)
|
|
{
|
|
TlacitFormular(sender);
|
|
}
|
|
|
|
void TlacitFormular(object _sender)
|
|
{
|
|
if (dataGridView16.SelectedRows.Count > 0)
|
|
{
|
|
if (dataGridView16.SelectedRows.Count < 11)
|
|
{
|
|
|
|
panel62.Visible = false;
|
|
Button btn = _sender as Button;
|
|
var selecteRows = dataGridView16.SelectedRows.Cast<DataGridViewRow>().ToList();
|
|
|
|
var ziadankySelected = selecteRows.Select(x =>
|
|
new ZiadankyInfo()
|
|
{
|
|
Nazov = x.Cells["Názov"].Value.ToString(),
|
|
Typ = x.Cells["Typ"].Value.ToString(),
|
|
Mnozstvo = Convert.ToDecimal(x.Cells["Množstvo"].Value),
|
|
PocetKs = Convert.ToInt32(x.Cells["Počet kusov"].Value),
|
|
IDZiadanka = Convert.ToInt32(x.Cells["IDZiadanka"].Value),
|
|
Cena = Convert.ToDecimal(x.Cells["Cena"].Value),
|
|
Jednotka = x.Cells["Jednotka"].Value.ToString()
|
|
}
|
|
).ToList();
|
|
|
|
var selectedIdList = selecteRows.Select(x => x.Cells["IDZiadanka"].Value.ToString()).ToList();
|
|
var selectedFirmaIdList = selecteRows.Select(x => x.Cells["IDFirma"].Value.ToString()).Distinct().ToList();
|
|
var doplnujuceinfoId = 0;
|
|
|
|
//if (selectedFirmaIdList.Count == 1)
|
|
//{
|
|
var hasAllEmpty = selecteRows.All(x => x.Cells["Číslo dokumentu"].Value.ToString() == string.Empty);
|
|
var areAllSame = !selecteRows.Any(x => x.Cells["Číslo dokumentu"].Value.ToString() != selecteRows[0].Cells["Číslo dokumentu"].Value.ToString());
|
|
|
|
if (hasAllEmpty)
|
|
{
|
|
Form frmDopInf = new frmZiadankaDoplnujuceInfo(ziadankySelected, btn.Tag.ToString(), label113.Text, doplnujuceinfoId);
|
|
frmDopInf.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
if (areAllSame)
|
|
{
|
|
DataTable doplnujuceInfoTabulka = new DataTable();
|
|
string cmd = $"SELECT `IdDoplnujuceInfo` FROM `mip`.`tabziadankadokument` WHERE `IdZiadanka` = {selecteRows[0].Cells["IDZiadanka"].Value.ToString()};";
|
|
classSQL.SQL(cmd, out doplnujuceInfoTabulka);
|
|
doplnujuceinfoId = Convert.ToInt32(doplnujuceInfoTabulka.Rows[0].ItemArray[0]);
|
|
|
|
Form frmDopInf = new frmZiadankaDoplnujuceInfo(ziadankySelected, btn.Tag.ToString(), label113.Text, doplnujuceinfoId);
|
|
frmDopInf.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show($"Dokument nie je možné vytvoriť, lebo niektoré žiadanky už záznam o dokumente majú v databáze!");
|
|
}
|
|
|
|
}
|
|
|
|
refreshZiadanky();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show($"Dokument je možné vytvoriť pre 10 alebo menej záznamov!");
|
|
}
|
|
}
|
|
}
|
|
|
|
private void button169_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView7.SelectedRows.Count != 0)
|
|
{
|
|
if (dataGridView7.SelectedRows[0].Cells["Status"].Value.ToString() != "Nacenená")
|
|
{
|
|
if (panel63.Visible == false)
|
|
{
|
|
classGlobal.FillCB(comboBox16, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať iný názov");
|
|
comboBox16.Text = dataGridView7.SelectedRows[0].Cells["Iný názov"].Value.ToString();
|
|
panel63.Visible = true;
|
|
}
|
|
else panel63.Visible = false;
|
|
}
|
|
else MessageBox.Show("Záznam bol nacenený, nedá sa editovať!");
|
|
}
|
|
else MessageBox.Show("Žiadne nacenenie nebolo vybrané na editovanie!");
|
|
|
|
}
|
|
|
|
private void button171_Click(object sender, EventArgs e)
|
|
{
|
|
panel63.Visible = false;
|
|
}
|
|
|
|
private void button170_Click(object sender, EventArgs e)
|
|
{
|
|
panel63.Visible = false;
|
|
string cmd = "UPDATE `mip`.`tabvyrobok` SET `InyNazov`= '" + comboBox16.Text + "' WHERE `IDVyrobok`= " + dataGridView7.SelectedRows[0].Cells["IDVyrobokNac"].Value.ToString() + "; ";
|
|
classSQL.SQL(cmd);
|
|
MessageBox.Show("Iný názov opravený!");
|
|
refreshNacenovanie();
|
|
}
|
|
|
|
private void panel41_Click(object sender, EventArgs e)
|
|
{
|
|
Form frmPridatFirmu = new frmAddFirma(Convert.ToInt32(dataGridView11.SelectedRows[0].Cells["IDFirma"].Value.ToString()));
|
|
frmPridatFirmu.Location = new Point(trackBar1.Location.X + 20, trackBar1.Location.Y + 116);
|
|
frmPridatFirmu.ShowDialog();
|
|
RefreshFirmy();
|
|
}
|
|
|
|
private void panel64_Click(object sender, EventArgs e)
|
|
{
|
|
Form frmPridatFirmu = new frmAddFirma(Convert.ToInt32(dataGridView11.SelectedRows[0].Cells["IDFirma"].Value.ToString()), true);
|
|
frmPridatFirmu.Location = new Point(trackBar1.Location.X + 20, trackBar1.Location.Y + 116);
|
|
frmPridatFirmu.ShowDialog();
|
|
RefreshFirmy();
|
|
}
|
|
|
|
private void checkBox63_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (classGlobal.PristupovePrava(classUser.ID, "Ziadanka-zobrazit vsetky") == false) checkBox63.Checked = false;
|
|
refreshZiadanky();
|
|
}
|
|
|
|
private void dataGridView16_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
dataGridView16.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView16.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
for (int i = 0; i < dataGridView16.Columns.Count; i++) dataGridView16.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
|
|
|
|
try
|
|
{
|
|
dataGridView16.Columns["FirmaMenoID"].Visible = false;
|
|
dataGridView16.Columns["IDZiadanka"].Visible = false;
|
|
dataGridView16.Columns["IDFirma"].Visible = false;
|
|
dataGridView16.Columns["Dátum zadania"].Width = 70;
|
|
dataGridView16.Columns["Dátum zadania"].DisplayIndex = 0;
|
|
dataGridView16.Columns["Dátum schválenia"].Width = 70;
|
|
dataGridView16.Columns["Dátum odoslania"].Width = 70;
|
|
dataGridView16.Columns["Potvrdený dátum"].Width = 70;
|
|
dataGridView16.Columns["Dátum prijatia"].Width = 70;
|
|
dataGridView16.Columns["Dátum vybavenia"].Width = 70;
|
|
dataGridView16.Columns["Status žiadanky"].MinimumWidth = 85;
|
|
dataGridView16.Columns["Status žiadanky"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView16.Columns["Schválil(a)"].MinimumWidth = 100;
|
|
dataGridView16.Columns["Schválil(a)"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView16.Columns["Status"].Visible = false;
|
|
dataGridView16.Columns["Názov"].MinimumWidth = 100;
|
|
dataGridView16.Columns["Názov"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView16.Columns["Názov"].DisplayIndex = 2;
|
|
dataGridView16.Columns["Typ"].MinimumWidth = 50;
|
|
dataGridView16.Columns["Typ"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView16.Columns["Typ"].DisplayIndex = 3;
|
|
dataGridView16.Columns["Firma"].MinimumWidth = 120;
|
|
dataGridView16.Columns["Firma"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView16.Columns["Firma"].DisplayIndex = 4;
|
|
dataGridView16.Columns["Poznámka"].MinimumWidth = 100;
|
|
dataGridView16.Columns["Poznámka"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView16.Columns["Poznámka"].DisplayIndex = 11;
|
|
dataGridView16.Columns["Termín"].Width = 70;
|
|
dataGridView16.Columns["Termín"].DisplayIndex = 5;
|
|
dataGridView16.Columns["Počet kusov"].Width = 60;
|
|
dataGridView16.Columns["Počet kusov"].DisplayIndex = 6;
|
|
dataGridView16.Columns["Množstvo"].Width = 60;
|
|
dataGridView16.Columns["Množstvo"].DisplayIndex = 7;
|
|
dataGridView16.Columns["Jednotka"].Width = 60;
|
|
dataGridView16.Columns["Jednotka"].DisplayIndex = 8;
|
|
dataGridView16.Columns["Faktúra"].Width = 80;
|
|
dataGridView16.Columns["Cena"].Width = 60;
|
|
dataGridView16.Columns["Cena"].DisplayIndex = 9;
|
|
dataGridView16.Columns["Číslo objednávky"].DisplayIndex = 10;
|
|
dataGridView16.Columns["IDUser"].Visible = false;
|
|
dataGridView16.Columns["Číslo dokumentu"].MinimumWidth = 95;
|
|
dataGridView16.Columns["Číslo dokumentu"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
dataGridView16.Columns["Meno"].MinimumWidth = 85;
|
|
dataGridView16.Columns["Meno"].DisplayIndex = 1;
|
|
dataGridView16.Columns["Meno"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
|
|
if (classGlobal.PristupovePrava(classUser.ID, "Ziadanka-schvalit") == false)
|
|
{
|
|
dataGridView16.Columns["Meno"].Visible = false;
|
|
dataGridView16.Columns["Cena"].Visible = false;
|
|
}
|
|
|
|
if (classGlobal.PristupovePrava(classUser.ID, "Ziadanka-operacie") == false)
|
|
{
|
|
dataGridView16.Columns["Faktúra"].Visible = false;
|
|
}
|
|
classGlobal.RowColor(dataGridView16, -1);
|
|
}
|
|
catch
|
|
{ }
|
|
|
|
}
|
|
|
|
private void button173_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView16.SelectedRows.Count > 0)
|
|
{
|
|
string cmd = $@"UPDATE `mip`.`tabziadanka`
|
|
SET `Status žiadanky` = 'Dopyt odoslaný', `Dátum odoslania` = DATE(NOW())
|
|
WHERE `IDZiadanka` IN ({SelectedIds});";
|
|
classSQL.SQL(cmd);
|
|
ReloadSelected = true;
|
|
refreshZiadanky();
|
|
}
|
|
}
|
|
|
|
private void button172_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView16.SelectedRows.Count > 0)
|
|
{
|
|
string cmd = $@"UPDATE `mip`.`tabziadanka`
|
|
SET `Status žiadanky` = 'Objednávka odoslaná', `Dátum odoslania` = DATE(NOW())
|
|
WHERE `IDZiadanka` IN ({SelectedIds});";
|
|
classSQL.SQL(cmd);
|
|
refreshZiadanky();
|
|
}
|
|
}
|
|
|
|
private void dataGridView16_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
this.Controls.Remove(monthcal);
|
|
if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
|
{
|
|
eRowIndexRV = e.RowIndex;
|
|
eColumnIndexRV = e.ColumnIndex;
|
|
bSignalRight = true;
|
|
|
|
if (dataGridView16.Columns[e.ColumnIndex].Name == "Názov" || dataGridView16.Columns[e.ColumnIndex].Name == "Typ" ||
|
|
dataGridView16.Columns[e.ColumnIndex].Name == "Poznámka" || dataGridView16.Columns[e.ColumnIndex].Name == "Firma" ||
|
|
dataGridView16.Columns[e.ColumnIndex].Name == "Číslo objednávky" || dataGridView16.Columns[e.ColumnIndex].Name == "Faktúra")
|
|
{
|
|
if (MessageBox.Show("Kopírovať obsah bunky?", "Kopírovať..", MessageBoxButtons.YesNo) == DialogResult.Yes) Clipboard.SetText(dataGridView16.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
|
|
}
|
|
|
|
}
|
|
else bSignalRight = false;
|
|
|
|
}
|
|
|
|
private void dataGridView16_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
if (dataGridView16.Columns[e.ColumnIndex].Name == "Dátum schválenia" || dataGridView16.Columns[e.ColumnIndex].Name == "Dátum odoslania" ||
|
|
dataGridView16.Columns[e.ColumnIndex].Name == "Potvrdený dátum" || dataGridView16.Columns[e.ColumnIndex].Name == "Dátum prijatia" ||
|
|
dataGridView16.Columns[e.ColumnIndex].Name == "Dátum vybavenia" || dataGridView16.Columns[e.ColumnIndex].Name == "Termín")
|
|
{
|
|
|
|
if (bSignalRight == true)
|
|
{
|
|
|
|
int x = 0; int y = 0;
|
|
|
|
if (MousePosition.X + monthcal.Width + 50 > this.Width) x = MousePosition.X - monthcal.Width;
|
|
else x = MousePosition.X;
|
|
if (MousePosition.Y + monthcal.Height + 70 > this.Height) y = MousePosition.Y - monthcal.Height;
|
|
else y = MousePosition.Y;
|
|
monthcal.Location = new Point(x, y - 35);
|
|
|
|
monthcal.SelectDay += new SelectDayEventHandler(monthcalSelectRemove2);
|
|
monthcal.MonthChanged += new ChangeMonthEventHandler(monthChange);
|
|
monthcal.YearChanged += new ChangeYearEventHandler(yearChange);
|
|
this.Controls.Add(monthcal);
|
|
monthcal.BringToFront();
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
void monthcalSelectRemove2(object sender, MonthCalendar.SelectDayEventArgs e)
|
|
{
|
|
if (boolCloseCal == false)
|
|
{
|
|
string format = "yyyy-MM-dd";
|
|
|
|
editDateRV = e.Date.ToString(format);
|
|
|
|
Int32 intIDZiadanka = 0;
|
|
intIDZiadanka = Convert.ToInt32(dataGridView16.Rows[eRowIndexRV].Cells["IDZiadanka"].Value);
|
|
string strColumnName = dataGridView16.Columns[eColumnIndexRV].Name.ToString();
|
|
|
|
string cmd = "UPDATE `mip`.`tabziadanka` SET `" + strColumnName + "` = '" + editDateRV + "' WHERE `IDZiadanka`=" + intIDZiadanka.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
|
|
monthcal.SelectDay -= new SelectDayEventHandler(monthcalSelectRemove2);
|
|
monthcal.MonthChanged -= new ChangeMonthEventHandler(monthChange);
|
|
monthcal.YearChanged -= new ChangeYearEventHandler(yearChange);
|
|
this.Controls.Remove(monthcal);
|
|
}
|
|
boolCloseCal = false;
|
|
|
|
}
|
|
|
|
private void checkBox64_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (classGlobal.PristupovePrava(classUser.ID, "Ziadanka-zobrazit vymazane") == false) checkBox64.Checked = false;
|
|
refreshZiadanky();
|
|
}
|
|
/*
|
|
private void dataGridView16_RowEnter(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (dataGridView16.SelectedRows.Count == 1)
|
|
{
|
|
DataGridViewRow dtgvr = dataGridView16.SelectedRows[0];
|
|
|
|
switch (dtgvr.Cells["Status žiadanky"].Value.ToString())
|
|
{
|
|
case "Prijatá":
|
|
|
|
break;
|
|
}
|
|
|
|
if (dtgvr.Cells["Status žiadanky"].Value.ToString() == "Prijatá") button57.Text = "Naceniť";
|
|
|
|
//else button57.Text = "Editovať";
|
|
}
|
|
}
|
|
*/
|
|
|
|
private void label118_Click(object sender, EventArgs e)
|
|
{
|
|
panel66.Visible = true;
|
|
}
|
|
|
|
private void label119_MouseEnter(object sender, EventArgs e)
|
|
{
|
|
panel66.Visible = false;
|
|
}
|
|
|
|
private void checkBox65_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZiadanky();
|
|
}
|
|
|
|
private void checkBox66_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZiadanky();
|
|
}
|
|
|
|
private void checkBox67_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZiadanky();
|
|
}
|
|
|
|
private void checkBox68_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZiadanky();
|
|
}
|
|
|
|
private void checkBox69_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZiadanky();
|
|
}
|
|
|
|
private void checkBox70_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZiadanky();
|
|
}
|
|
|
|
private void checkBox71_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZiadanky();
|
|
}
|
|
|
|
private void checkBox72_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZiadanky();
|
|
}
|
|
|
|
private void checkBox73_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
refreshZiadanky();
|
|
}
|
|
|
|
private void dataGridView16_RowEnter(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
//if (classGlobal.PristupovePrava(classUser.ID, "Ziadanka-zobrazit vymazane") == false)
|
|
if (dataGridView16.SelectedRows.Count > 0)
|
|
{
|
|
if (dataGridView16.SelectedRows[0].Cells["Nákres"].Value.ToString() == "Áno") button135.BackColor = Color.Coral;
|
|
else button135.BackColor = SystemColors.ControlLight;
|
|
|
|
}
|
|
|
|
if (dataGridView16.SelectedRows.Count > 0)
|
|
{
|
|
switch (dataGridView16.SelectedRows[0].Cells["Status žiadanky"].Value.ToString())
|
|
{
|
|
case "Prijatá":
|
|
{
|
|
button122.Enabled = true; //pridat
|
|
button128.Enabled = true; //editovat
|
|
button129.Enabled = true; //vymazat
|
|
button135.Enabled = true; //zobrazit nakres
|
|
button125.Enabled = false; //nevybavena
|
|
button126.Enabled = false; //vybavena
|
|
button124.Enabled = true; //zamietnut
|
|
button123.Enabled = true; //schvalit
|
|
button127.Enabled = true; //multiselect
|
|
button152.Enabled = false; //potvrdeny datum
|
|
button130.Enabled = true; //export pdf
|
|
button155.Enabled = true; //vytlacit
|
|
button157.Enabled = true; //priradit cenu
|
|
button156.Enabled = false; //priradit fakturu
|
|
button173.Enabled = false; //dopyt odoslany
|
|
button172.Enabled = false; //objednavka odoslana
|
|
button175.Enabled = false; //cislo objednavky
|
|
button174.Enabled = false; //tovar doruceny
|
|
}
|
|
break;
|
|
case "Zamietnutá":
|
|
{
|
|
button122.Enabled = true; //pridat
|
|
button128.Enabled = false; //editovat
|
|
button129.Enabled = true; //vymazat
|
|
button135.Enabled = true; //zobrazit nakres
|
|
button125.Enabled = false; //nevybavena
|
|
button126.Enabled = false; //vybavena
|
|
button124.Enabled = false; //zamietnut
|
|
button123.Enabled = true; //schvalit
|
|
button127.Enabled = true; //multiselect
|
|
button152.Enabled = true; //potvrdeny datum
|
|
button130.Enabled = true; //export pdf
|
|
button155.Enabled = true; //vytlacit
|
|
button157.Enabled = true; //priradit cenu
|
|
button156.Enabled = false; //priradit fakturu
|
|
button173.Enabled = false; //dopyt odoslany
|
|
button172.Enabled = false; //objednavka odoslana
|
|
button175.Enabled = false; //cislo objednavky
|
|
button174.Enabled = false; //tovar doruceny
|
|
}
|
|
break;
|
|
case "Schválená":
|
|
{
|
|
button122.Enabled = true; //pridat
|
|
button128.Enabled = true; //editovat
|
|
button129.Enabled = true; //vymazat
|
|
button135.Enabled = true; //zobrazit nakres
|
|
button125.Enabled = false; //nevybavena
|
|
button126.Enabled = false; //vybavena
|
|
button124.Enabled = true; //zamietnut
|
|
button123.Enabled = false; //schvalit
|
|
button127.Enabled = true; //multiselect
|
|
button152.Enabled = false; //potvrdeny datum
|
|
button130.Enabled = true; //export pdf
|
|
button155.Enabled = true; //vytlacit
|
|
button157.Enabled = true; //priradit cenu
|
|
button156.Enabled = false; //priradit fakturu
|
|
button173.Enabled = true; //dopyt odoslany
|
|
button172.Enabled = true; //objednavka odoslana
|
|
button175.Enabled = true; //cislo objednavky
|
|
button174.Enabled = false; //tovar doruceny
|
|
}
|
|
break;
|
|
case "Dopyt odoslaný":
|
|
{
|
|
button122.Enabled = true; //pridat
|
|
button128.Enabled = true; //editovat
|
|
button129.Enabled = true; //vymazat
|
|
button135.Enabled = true; //zobrazit nakres
|
|
button125.Enabled = false; //nevybavena
|
|
button126.Enabled = false; //vybavena
|
|
button124.Enabled = false; //zamietnut
|
|
button123.Enabled = true; //schvalit
|
|
button127.Enabled = true; //multiselect
|
|
button152.Enabled = true; //potvrdeny datum
|
|
button130.Enabled = true; //export pdf
|
|
button155.Enabled = true; //vytlacit
|
|
button157.Enabled = true; //priradit cenu
|
|
button156.Enabled = false; //priradit fakturu
|
|
button173.Enabled = true; //dopyt odoslany
|
|
button172.Enabled = true; //objednavka odoslana
|
|
button175.Enabled = true; //cislo objednavky
|
|
button174.Enabled = false; //tovar doruceny
|
|
}
|
|
break;
|
|
case "Objednávka odoslaná":
|
|
{
|
|
button122.Enabled = true; //pridat
|
|
button128.Enabled = true; //editovat
|
|
button129.Enabled = true; //vymazat
|
|
button135.Enabled = true; //zobrazit nakres
|
|
button125.Enabled = false; //nevybavena
|
|
button126.Enabled = true; //vybavena
|
|
button124.Enabled = false; //zamietnut
|
|
button123.Enabled = false; //schvalit
|
|
button127.Enabled = true; //multiselect
|
|
button152.Enabled = true; //potvrdeny datum
|
|
button130.Enabled = true; //export pdf
|
|
button155.Enabled = true; //vytlacit
|
|
button157.Enabled = true; //priradit cenu
|
|
button156.Enabled = false; //priradit fakturu
|
|
button173.Enabled = true; //dopyt odoslany
|
|
button172.Enabled = true; //objednavka odoslana
|
|
button175.Enabled = true; //cislo objednavky
|
|
button174.Enabled = true; //tovar doruceny
|
|
}
|
|
break;
|
|
case "Potvrdená":
|
|
{
|
|
button122.Enabled = true; //pridat
|
|
button128.Enabled = true; //editovat
|
|
button129.Enabled = true; //vymazat
|
|
button135.Enabled = true; //zobrazit nakres
|
|
button125.Enabled = true; //nevybavena
|
|
button126.Enabled = true; //vybavena
|
|
button124.Enabled = false; //zamietnut
|
|
button123.Enabled = false; //schvalit
|
|
button127.Enabled = true; //multiselect
|
|
button152.Enabled = true; //potvrdeny datum
|
|
button130.Enabled = true; //export pdf
|
|
button155.Enabled = true; //vytlacit
|
|
button157.Enabled = true; //priradit cenu
|
|
button156.Enabled = false; //priradit fakturu
|
|
button173.Enabled = false; //dopyt odoslany
|
|
button172.Enabled = true; //objednavka odoslana
|
|
button175.Enabled = true; //cislo objednavky
|
|
button174.Enabled = true; //tovar doruceny
|
|
}
|
|
break;
|
|
case "Tovar doručený":
|
|
{
|
|
button122.Enabled = true; //pridat
|
|
button128.Enabled = true; //editovat
|
|
button129.Enabled = true; //vymazat
|
|
button135.Enabled = true; //zobrazit nakres
|
|
button125.Enabled = true; //nevybavena
|
|
button126.Enabled = true; //vybavena
|
|
button124.Enabled = false; //zamietnut
|
|
button123.Enabled = false; //schvalit
|
|
button127.Enabled = true; //multiselect
|
|
button152.Enabled = true; //potvrdeny datum
|
|
button130.Enabled = true; //export pdf
|
|
button155.Enabled = true; //vytlacit
|
|
button157.Enabled = true; //priradit cenu
|
|
button156.Enabled = true; //priradit fakturu
|
|
button173.Enabled = true; //dopyt odoslany
|
|
button172.Enabled = true; //objednavka odoslana
|
|
button175.Enabled = false; //cislo objednavky
|
|
button174.Enabled = true; //tovar doruceny
|
|
}
|
|
break;
|
|
case "Vybavená":
|
|
{
|
|
button122.Enabled = true; //pridat
|
|
button128.Enabled = false; //editovat
|
|
button129.Enabled = false; //vymazat
|
|
button135.Enabled = true; //zobrazit nakres
|
|
button125.Enabled = true; //nevybavena
|
|
button126.Enabled = false; //vybavena
|
|
button124.Enabled = false; //zamietnut
|
|
button123.Enabled = false; //schvalit
|
|
button127.Enabled = false; //multiselect
|
|
button152.Enabled = false; //potvrdeny datum
|
|
button130.Enabled = true; //export pdf
|
|
button155.Enabled = true; //vytlacit
|
|
button157.Enabled = false; //priradit cenu
|
|
button156.Enabled = true; //priradit fakturu
|
|
button173.Enabled = true; //dopyt odoslany
|
|
button172.Enabled = true; //objednavka odoslana
|
|
button175.Enabled = false; //cislo objednavky
|
|
button174.Enabled = true; //tovar doruceny
|
|
}
|
|
break;
|
|
case "Nevybavená":
|
|
{
|
|
button122.Enabled = true; //pridat
|
|
button128.Enabled = false; //editovat
|
|
button129.Enabled = true; //vymazat
|
|
button135.Enabled = true; //zobrazit nakres
|
|
button125.Enabled = false; //nevybavena
|
|
button126.Enabled = true; //vybavena
|
|
button124.Enabled = false; //zamietnut
|
|
button123.Enabled = false; //schvalit
|
|
button127.Enabled = false; //multiselect
|
|
button152.Enabled = false; //potvrdeny datum
|
|
button130.Enabled = false; //export pdf
|
|
button155.Enabled = false; //vytlacit
|
|
button157.Enabled = true; //priradit cenu
|
|
button156.Enabled = false; //priradit fakturu
|
|
button173.Enabled = true; //dopyt odoslany
|
|
button172.Enabled = true; //objednavka odoslana
|
|
button175.Enabled = false; //cislo objednavky
|
|
button174.Enabled = true; //tovar doruceny
|
|
}
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void button168_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void button99_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView7.SelectedRows[0].Cells["Status"].Value.ToString() == "Prijatá")
|
|
{
|
|
string cmd;
|
|
cmd = "UPDATE `mip`.`tab-nacenovanie` SET `Status` = 'Zrušená' WHERE `IDNacenovanie`= " + dataGridView7.SelectedRows[0].Cells["IDNacenovanie"].Value.ToString() + ";";
|
|
|
|
if (MessageBox.Show("Naozaj zrušiť cenovú ponuku?", "Zrušiť cenovú ponuku", MessageBoxButtons.YesNo) == DialogResult.Yes) { classSQL.SQL(cmd); this.Close(); }
|
|
}
|
|
else MessageBox.Show("Cenová ponuka bola nacenená a nedá sa zrušiť.");
|
|
|
|
refreshNacenovanie();
|
|
}
|
|
|
|
DataTable tabZmatky = new DataTable();
|
|
private void tabPage8_Enter(object sender, EventArgs e)
|
|
{
|
|
string cmd = "select * from `pohladzmetkovitost-export` order by `Percento` DESC";
|
|
classSQL.SQL(cmd, out tabZmatky);
|
|
|
|
cmd = "select distinct `Obdobie` from `pohladzmetkovitost-export` order by `Obdobie`;";
|
|
DataTable tabObdobia = new DataTable();
|
|
classSQL.SQL(cmd, out tabObdobia);
|
|
|
|
comboBox17.Items.Clear();
|
|
comboBox17.Items.Add("");
|
|
foreach (DataRow row in tabObdobia.Rows) comboBox17.Items.Add(row["Obdobie"].ToString());
|
|
|
|
label148.Text = "1 - " + numericUpDown31.Value.ToString();
|
|
label149.Text = (1 + numericUpDown31.Value).ToString() + " - " + numericUpDown32.Value.ToString();
|
|
label150.Text = (1 + numericUpDown32.Value).ToString() + " - " + numericUpDown33.Value.ToString();
|
|
label151.Text = (1 + numericUpDown33.Value).ToString() + " - " + numericUpDown34.Value.ToString();
|
|
label152.Text = (1 + numericUpDown34.Value).ToString() + " - " + numericUpDown35.Value.ToString();
|
|
label153.Text = (1 + numericUpDown35.Value).ToString() + " - " + numericUpDown36.Value.ToString();
|
|
label154.Text = (1 + numericUpDown36.Value).ToString() + " - ∞";
|
|
|
|
//refreshZmetkovitostExport();
|
|
}
|
|
|
|
void refreshZmetkovitostExport()
|
|
{
|
|
if (comboBox17.Text != "" && comboBox18.Text != "")
|
|
{
|
|
DataView dvZmatky = new DataView(tabZmatky);
|
|
string dvZmatkyFilter = "Obdobie >= " + comboBox17.Text + " AND Obdobie <= " + comboBox18.Text;
|
|
dvZmatky.RowFilter = dvZmatkyFilter;
|
|
|
|
DataView dv = new DataView(dvZmatky.ToTable());
|
|
if (dataGridView18.Tag.ToString() != null) dv.RowFilter = dataGridView18.Tag.ToString();
|
|
dataGridView18.DataSource = dv;
|
|
|
|
string filter = "";
|
|
DataView kat01 = new DataView(dvZmatky.ToTable());
|
|
label137.Text = kat01.Count.ToString();
|
|
|
|
DataView kat02 = new DataView(dvZmatky.ToTable());
|
|
filter = "StatusZaznamu = 'Údaje vyplnené' AND ObjednanýPočetKusov <= " + numericUpDown31.Value.ToString();
|
|
kat02.RowFilter = filter;
|
|
label138.Text = kat02.Count.ToString();
|
|
|
|
DataView kat03 = new DataView(dvZmatky.ToTable());
|
|
filter = "StatusZaznamu = 'Údaje vyplnené' AND ObjednanýPočetKusov <= " + numericUpDown32.Value.ToString() + " AND ObjednanýPočetKusov > " + numericUpDown31.Value.ToString();
|
|
kat03.RowFilter = filter;
|
|
label139.Text = kat03.Count.ToString();
|
|
|
|
DataView kat04 = new DataView(dvZmatky.ToTable());
|
|
filter = "StatusZaznamu = 'Údaje vyplnené' AND ObjednanýPočetKusov <= " + numericUpDown33.Value.ToString() + " AND ObjednanýPočetKusov > " + numericUpDown32.Value.ToString();
|
|
kat04.RowFilter = filter;
|
|
label140.Text = kat04.Count.ToString();
|
|
|
|
DataView kat05 = new DataView(dvZmatky.ToTable());
|
|
filter = "StatusZaznamu = 'Údaje vyplnené' AND ObjednanýPočetKusov <= " + numericUpDown34.Value.ToString() + " AND ObjednanýPočetKusov > " + numericUpDown33.Value.ToString();
|
|
kat05.RowFilter = filter;
|
|
label141.Text = kat05.Count.ToString();
|
|
|
|
DataView kat06 = new DataView(dvZmatky.ToTable());
|
|
filter = "StatusZaznamu = 'Údaje vyplnené' AND ObjednanýPočetKusov <= " + numericUpDown35.Value.ToString() + " AND ObjednanýPočetKusov > " + numericUpDown34.Value.ToString();
|
|
kat06.RowFilter = filter;
|
|
label142.Text = kat06.Count.ToString();
|
|
|
|
DataView kat07 = new DataView(dvZmatky.ToTable());
|
|
filter = "StatusZaznamu = 'Údaje vyplnené' AND ObjednanýPočetKusov <= " + numericUpDown36.Value.ToString() + " AND ObjednanýPočetKusov > " + numericUpDown35.Value.ToString();
|
|
kat07.RowFilter = filter;
|
|
label143.Text = kat07.Count.ToString();
|
|
|
|
DataView kat08 = new DataView(dvZmatky.ToTable());
|
|
filter = "StatusZaznamu = 'Údaje vyplnené' AND ObjednanýPočetKusov > " + numericUpDown36.Value.ToString();
|
|
kat08.RowFilter = filter;
|
|
label144.Text = kat08.Count.ToString();
|
|
|
|
DataView kat09 = new DataView(dvZmatky.ToTable());
|
|
filter = "StatusZaznamu = 'Nevyhodnocuje sa!'";
|
|
kat09.RowFilter = filter;
|
|
label145.Text = kat09.Count.ToString();
|
|
|
|
DataView kat10 = new DataView(dvZmatky.ToTable());
|
|
filter = "StatusZaznamu = 'Bez záznamu'";
|
|
kat10.RowFilter = filter;
|
|
label146.Text = kat10.Count.ToString();
|
|
|
|
DataView kat11 = new DataView(dvZmatky.ToTable());
|
|
filter = "StatusZaznamu = 'Chybný záznam'";
|
|
kat11.RowFilter = filter;
|
|
label147.Text = kat11.Count.ToString();
|
|
|
|
|
|
if (checkBox60.Checked == true) lblZobrazenyPocet.Text = dvZmatky.Count.ToString();//classSQL.intCelkovyPocetZazanmov.ToString();
|
|
|
|
//MessageBox.Show(PocitacZmatkov(kat02, "Priemer zmetkovitostí").ToString());
|
|
//MessageBox.Show(PocitacZmatkov(kat02, "Priemerná zmetkovitosť").ToString());
|
|
chart1.Series["Priemerná zmätkovitosť"].Enabled = true;
|
|
chart1.Series["Priemer zmätkovitostí"].Enabled = true;
|
|
|
|
chart1.Series["Priemerná zmätkovitosť"].Points.Clear();
|
|
chart1.Series["Priemerná zmätkovitosť"].Points.Add((double)PocitacZmatkov(kat02, "Priemerná zmetkovitosť"));
|
|
chart1.Series["Priemerná zmätkovitosť"].Points.Add((double)PocitacZmatkov(kat03, "Priemerná zmetkovitosť"));
|
|
chart1.Series["Priemerná zmätkovitosť"].Points.Add((double)PocitacZmatkov(kat04, "Priemerná zmetkovitosť"));
|
|
chart1.Series["Priemerná zmätkovitosť"].Points.Add((double)PocitacZmatkov(kat05, "Priemerná zmetkovitosť"));
|
|
chart1.Series["Priemerná zmätkovitosť"].Points.Add((double)PocitacZmatkov(kat06, "Priemerná zmetkovitosť"));
|
|
chart1.Series["Priemerná zmätkovitosť"].Points.Add((double)PocitacZmatkov(kat07, "Priemerná zmetkovitosť"));
|
|
chart1.Series["Priemerná zmätkovitosť"].Points.Add((double)PocitacZmatkov(kat08, "Priemerná zmetkovitosť"));
|
|
|
|
chart1.Series["Priemer zmätkovitostí"].Points.Clear();
|
|
chart1.Series["Priemer zmätkovitostí"].Points.Add((double)PocitacZmatkov(kat02, "Priemer zmetkovitostí"));
|
|
chart1.Series["Priemer zmätkovitostí"].Points.Add((double)PocitacZmatkov(kat03, "Priemer zmetkovitostí"));
|
|
chart1.Series["Priemer zmätkovitostí"].Points.Add((double)PocitacZmatkov(kat04, "Priemer zmetkovitostí"));
|
|
chart1.Series["Priemer zmätkovitostí"].Points.Add((double)PocitacZmatkov(kat05, "Priemer zmetkovitostí"));
|
|
chart1.Series["Priemer zmätkovitostí"].Points.Add((double)PocitacZmatkov(kat06, "Priemer zmetkovitostí"));
|
|
chart1.Series["Priemer zmätkovitostí"].Points.Add((double)PocitacZmatkov(kat07, "Priemer zmetkovitostí"));
|
|
chart1.Series["Priemer zmätkovitostí"].Points.Add((double)PocitacZmatkov(kat08, "Priemer zmetkovitostí"));
|
|
|
|
}
|
|
}
|
|
|
|
private decimal PocitacZmatkov(DataView _DataView, string _typvystupu)
|
|
{
|
|
decimal outputValue = 0;
|
|
|
|
|
|
if (_typvystupu == "Priemer zmetkovitostí")
|
|
{
|
|
Decimal hodnota = 0;
|
|
foreach (DataRowView drv in _DataView) hodnota = hodnota + Convert.ToDecimal(drv["Percento"]);
|
|
//for (DataRow i = 0 in _da; i < _DataView.Count; i++)
|
|
if (_DataView.Count != 0) outputValue = Convert.ToDecimal(hodnota / _DataView.Count);
|
|
else outputValue = 0;
|
|
}
|
|
else
|
|
{
|
|
Decimal sucetZmatkov = 0;
|
|
Decimal sucetVydanych = 0;
|
|
|
|
foreach (DataRowView drv in _DataView)
|
|
{
|
|
sucetVydanych = sucetVydanych + Convert.ToDecimal(drv["Počet vydaných kusov"]);
|
|
sucetZmatkov = sucetZmatkov + Convert.ToDecimal(drv["PocetZmatkov"]);
|
|
|
|
}
|
|
|
|
if (sucetVydanych != 0) outputValue = Convert.ToDecimal(sucetZmatkov / sucetVydanych) * 100;
|
|
else outputValue = 0;
|
|
}
|
|
|
|
return Math.Round(outputValue, 3);
|
|
}
|
|
|
|
private void PocitacZmatkov(DataView _DataView)
|
|
{
|
|
foreach (DataRow dr in _DataView) ;
|
|
}
|
|
|
|
private void comboBox18_SelectedValueChanged(object sender, EventArgs e)
|
|
{
|
|
button176.Focus();
|
|
refreshZmetkovitostExport();
|
|
}
|
|
|
|
private void comboBox17_SelectedValueChanged(object sender, EventArgs e)
|
|
{
|
|
setComboBoxDateTo();
|
|
comboBox18.Focus();
|
|
//refreshZmetkovitostExport();
|
|
}
|
|
|
|
private void setComboBoxDateTo()
|
|
{
|
|
if (comboBox17.Text != "")
|
|
{
|
|
label121.Enabled = true;
|
|
comboBox18.Enabled = true;
|
|
|
|
string limit = "";
|
|
if (label158.BackColor == Color.Coral) limit = "limit 1";
|
|
else if (label160.BackColor == Color.Coral) limit = "limit 3";
|
|
else if (label159.BackColor == Color.Coral) limit = "limit 12";
|
|
else limit = "";
|
|
|
|
string cmd = "select distinct `Obdobie` from `pohladzmetkovitost-export` where `Obdobie` >= " + comboBox17.Text + " order by `Obdobie`" + limit + ";";
|
|
DataTable tabObdobiaDO = new DataTable();
|
|
classSQL.SQL(cmd, out tabObdobiaDO);
|
|
|
|
comboBox18.Items.Clear();
|
|
comboBox18.Text = "";
|
|
//comboBox18.Items.Add("");
|
|
foreach (DataRow row in tabObdobiaDO.Rows) comboBox18.Items.Add(row["Obdobie"].ToString());
|
|
}
|
|
else
|
|
{
|
|
label121.Enabled = false;
|
|
comboBox18.Enabled = false;
|
|
}
|
|
}
|
|
|
|
private void panel67_MouseEnter(object sender, EventArgs e)
|
|
{
|
|
panel67.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
if (Convert.ToBoolean(panel67.Tag) == true) panel67.BackgroundImage = Mip.Properties.Resources.Arrow_left;
|
|
else panel67.BackgroundImage = Mip.Properties.Resources.Arrow_right;
|
|
|
|
}
|
|
|
|
private void panel67_MouseLeave(object sender, EventArgs e)
|
|
{
|
|
if (Convert.ToBoolean(panel67.Tag) == true)
|
|
{
|
|
panel67.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
|
panel67.BackgroundImage = null;
|
|
}
|
|
|
|
}
|
|
|
|
private void panel67_Click(object sender, EventArgs e)
|
|
{
|
|
if (Convert.ToBoolean(panel67.Tag) == true)
|
|
{
|
|
panel67.Tag = false;
|
|
panel67.Location = new Point(panel67.Location.X - 100, panel67.Location.Y);
|
|
panel67.Size = new Size(panel67.Size.Width + 100, panel67.Size.Height);
|
|
panel67.BackgroundImage = Mip.Properties.Resources.Arrow_right;
|
|
|
|
}
|
|
else
|
|
{
|
|
panel67.Location = new Point(panel67.Location.X + 100, panel67.Location.Y);
|
|
panel67.Size = new Size(panel67.Size.Width - 100, panel67.Size.Height);
|
|
panel67.BackgroundImage = Mip.Properties.Resources.Arrow_left;
|
|
panel67.Tag = true;
|
|
}
|
|
|
|
}
|
|
|
|
private void numericUpDown31_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
numericUpDown32.Minimum = numericUpDown31.Value + 1;
|
|
label148.Text = "1 - " + numericUpDown31.Value.ToString();
|
|
label149.Text = (1 + numericUpDown31.Value).ToString() + " - " + numericUpDown32.Value.ToString();
|
|
refreshZmetkovitostExport();
|
|
|
|
}
|
|
|
|
private void numericUpDown32_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
numericUpDown31.Maximum = numericUpDown32.Value - 1;
|
|
numericUpDown33.Minimum = numericUpDown32.Value + 1;
|
|
label149.Text = (1 + numericUpDown31.Value).ToString() + " - " + numericUpDown32.Value.ToString();
|
|
label150.Text = (1 + numericUpDown32.Value).ToString() + " - " + numericUpDown33.Value.ToString();
|
|
refreshZmetkovitostExport();
|
|
}
|
|
|
|
private void numericUpDown33_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
numericUpDown32.Maximum = numericUpDown33.Value - 1;
|
|
numericUpDown34.Minimum = numericUpDown33.Value + 1;
|
|
label150.Text = (1 + numericUpDown32.Value).ToString() + " - " + numericUpDown33.Value.ToString();
|
|
label151.Text = (1 + numericUpDown33.Value).ToString() + " - " + numericUpDown34.Value.ToString();
|
|
refreshZmetkovitostExport();
|
|
}
|
|
|
|
private void numericUpDown34_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
numericUpDown33.Maximum = numericUpDown34.Value - 1;
|
|
numericUpDown35.Minimum = numericUpDown34.Value + 1;
|
|
label151.Text = (1 + numericUpDown33.Value).ToString() + " - " + numericUpDown34.Value.ToString();
|
|
label152.Text = (1 + numericUpDown34.Value).ToString() + " - " + numericUpDown35.Value.ToString();
|
|
refreshZmetkovitostExport();
|
|
}
|
|
|
|
private void numericUpDown35_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
numericUpDown34.Maximum = numericUpDown35.Value - 1;
|
|
numericUpDown36.Minimum = numericUpDown35.Value + 1;
|
|
label152.Text = (1 + numericUpDown34.Value).ToString() + " - " + numericUpDown35.Value.ToString();
|
|
label153.Text = (1 + numericUpDown35.Value).ToString() + " - " + numericUpDown36.Value.ToString();
|
|
refreshZmetkovitostExport();
|
|
}
|
|
|
|
private void numericUpDown36_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
numericUpDown35.Maximum = numericUpDown36.Value - 1;
|
|
label153.Text = (1 + numericUpDown35.Value).ToString() + " - " + numericUpDown36.Value.ToString();
|
|
label154.Text = (1 + numericUpDown36.Value).ToString() + " - ∞";
|
|
refreshZmetkovitostExport();
|
|
}
|
|
|
|
private void label158_Click(object sender, EventArgs e)
|
|
{
|
|
if (label158.BackColor == Color.Beige)
|
|
{
|
|
label158.BackColor = Color.Coral;
|
|
label159.BackColor = Color.Beige;
|
|
label160.BackColor = Color.Beige;
|
|
label161.BackColor = Color.Beige;
|
|
}
|
|
setComboBoxDateTo();
|
|
}
|
|
|
|
private void label159_Click(object sender, EventArgs e)
|
|
{
|
|
if (label159.BackColor == Color.Beige)
|
|
{
|
|
label159.BackColor = Color.Coral;
|
|
label158.BackColor = Color.Beige;
|
|
label160.BackColor = Color.Beige;
|
|
label161.BackColor = Color.Beige;
|
|
}
|
|
setComboBoxDateTo();
|
|
}
|
|
|
|
private void label160_Click(object sender, EventArgs e)
|
|
{
|
|
if (label160.BackColor == Color.Beige)
|
|
{
|
|
label160.BackColor = Color.Coral;
|
|
label159.BackColor = Color.Beige;
|
|
label158.BackColor = Color.Beige;
|
|
label161.BackColor = Color.Beige;
|
|
}
|
|
setComboBoxDateTo();
|
|
}
|
|
|
|
private void label161_Click(object sender, EventArgs e)
|
|
{
|
|
if (label161.BackColor == Color.Beige)
|
|
{
|
|
label161.BackColor = Color.Coral;
|
|
label159.BackColor = Color.Beige;
|
|
label160.BackColor = Color.Beige;
|
|
label158.BackColor = Color.Beige;
|
|
}
|
|
setComboBoxDateTo();
|
|
}
|
|
|
|
private void label122_Click(object sender, EventArgs e)
|
|
{
|
|
if (label122.BackColor == Color.Beige)
|
|
{
|
|
label122.BackColor = Color.Coral;
|
|
label123.BackColor = Color.Beige;
|
|
label124.BackColor = Color.Beige;
|
|
label125.BackColor = Color.Beige;
|
|
dataGridView18.Tag = "Percento >=0";
|
|
refreshZmetkovitostExport();
|
|
}
|
|
}
|
|
|
|
private void label123_Click(object sender, EventArgs e)
|
|
{
|
|
if (label123.BackColor == Color.Beige)
|
|
{
|
|
label123.BackColor = Color.Coral;
|
|
label122.BackColor = Color.Beige;
|
|
label124.BackColor = Color.Beige;
|
|
label125.BackColor = Color.Beige;
|
|
dataGridView18.Tag = "Percento >=10";
|
|
refreshZmetkovitostExport();
|
|
}
|
|
}
|
|
|
|
private void label124_Click(object sender, EventArgs e)
|
|
{
|
|
if (label124.BackColor == Color.Beige)
|
|
{
|
|
label124.BackColor = Color.Coral;
|
|
label123.BackColor = Color.Beige;
|
|
label122.BackColor = Color.Beige;
|
|
label125.BackColor = Color.Beige;
|
|
dataGridView18.Tag = "Percento >=25";
|
|
refreshZmetkovitostExport();
|
|
}
|
|
}
|
|
|
|
private void label125_Click(object sender, EventArgs e)
|
|
{
|
|
if (label125.BackColor == Color.Beige)
|
|
{
|
|
label125.BackColor = Color.Coral;
|
|
label123.BackColor = Color.Beige;
|
|
label124.BackColor = Color.Beige;
|
|
label122.BackColor = Color.Beige;
|
|
dataGridView18.Tag = "Percento >=50";
|
|
refreshZmetkovitostExport();
|
|
}
|
|
}
|
|
|
|
private void button176_Click(object sender, EventArgs e)
|
|
{
|
|
refreshZmetkovitostExport();
|
|
}
|
|
|
|
private void dataGridView18_DataSourceChanged(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView18.Rows.Count != 0)
|
|
{
|
|
dataGridView18.SuspendLayout();
|
|
dataGridView18.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView18.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
foreach (DataGridViewColumn dgvc in dataGridView18.Columns) dgvc.Visible = false;
|
|
|
|
dataGridView18.Columns["Zákazkové číslo"].Visible = true;
|
|
dataGridView18.Columns["Počet vydaných kusov"].Visible = true;
|
|
dataGridView18.Columns["PocetZmatkov"].Visible = true;
|
|
dataGridView18.Columns["Percento"].Visible = true;
|
|
|
|
dataGridView18.Columns["Zákazkové číslo"].HeaderText = "Zákazkové číslo";
|
|
dataGridView18.Columns["Počet vydaných kusov"].HeaderText = "Vydané kusy";
|
|
dataGridView18.Columns["PocetZmatkov"].HeaderText = "Zmätky";
|
|
dataGridView18.Columns["Percento"].HeaderText = "Percento";
|
|
|
|
dataGridView18.Columns["Zákazkové číslo"].Width = 77;
|
|
dataGridView18.Columns["Počet vydaných kusov"].Width = 77;
|
|
dataGridView18.Columns["PocetZmatkov"].Width = 76;
|
|
dataGridView18.Columns["Percento"].Width = 76;
|
|
|
|
classGlobal.RowColor(dataGridView18, -1);
|
|
dataGridView18.ResumeLayout();
|
|
}
|
|
}
|
|
|
|
private void button179_Click(object sender, EventArgs e)
|
|
{
|
|
Form showVykres = new frmShowVykres(dataGridView18.SelectedRows[0].Cells["Zákazník"].Value.ToString(), Convert.ToInt32(dataGridView18.SelectedRows[0].Cells["IDVyrobok"].Value.ToString()));
|
|
showVykres.ShowDialog();
|
|
|
|
}
|
|
|
|
private void button102_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void dataGridView18_RowEnter(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (dataGridView18.SelectedRows.Count > 0)
|
|
{
|
|
label176.Text = dataGridView18.SelectedRows[0].Cells["Zákazník"].Value.ToString();
|
|
label178.Text = dataGridView18.SelectedRows[0].Cells["Spojené rozmery"].Value.ToString();
|
|
label180.Text = dataGridView18.SelectedRows[0].Cells["Materiál"].Value.ToString() + "+" + dataGridView18.SelectedRows[0].Cells["Úprava materiálu"].Value.ToString();
|
|
label162.Text = dataGridView18.SelectedRows[0].Cells["Rezanie"].Value.ToString();
|
|
label163.Text = dataGridView18.SelectedRows[0].Cells["Klasika"].Value.ToString();
|
|
label164.Text = dataGridView18.SelectedRows[0].Cells["Impregnacia"].Value.ToString();
|
|
label165.Text = dataGridView18.SelectedRows[0].Cells["CNC"].Value.ToString();
|
|
label166.Text = dataGridView18.SelectedRows[0].Cells["KontrolaLapovanie"].Value.ToString();
|
|
label167.Text = dataGridView18.SelectedRows[0].Cells["ChybyMaterialu"].Value.ToString();
|
|
}
|
|
|
|
}
|
|
|
|
private void dataGridView7_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
|
|
{
|
|
if (e.RowIndex == -1)
|
|
{
|
|
if (e.ColumnIndex == NacenovanieColorIndex)
|
|
{
|
|
using (Brush brush = new SolidBrush(Color.YellowGreen))
|
|
{
|
|
e.Graphics.FillRectangle(brush, e.CellBounds);
|
|
e.PaintContent(e.ClipBounds);
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
/*
|
|
else
|
|
{
|
|
using (Brush brush = new SolidBrush(Color.Transparent))
|
|
{
|
|
e.Graphics.FillRectangle(brush, e.CellBounds);
|
|
e.PaintContent(e.ClipBounds);
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
*/
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void dataGridView16_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
var pocet = FilterQueue?.Count();
|
|
var nazovStlpca = dataGridView16.Columns[e.ColumnIndex].Name.ToString();
|
|
|
|
if (!FilterQueue.Contains(nazovStlpca))
|
|
{
|
|
if (pocet < 2)
|
|
{
|
|
FilterQueue.Enqueue(nazovStlpca);
|
|
}
|
|
else
|
|
{
|
|
FilterQueue.Dequeue();
|
|
FilterQueue.Enqueue(nazovStlpca);
|
|
}
|
|
ConfigureFilters(pocet.Value);
|
|
refreshZiadanky();
|
|
}
|
|
/*
|
|
if(NacenovanieColorIndex != e.ColumnIndex && NacenovanieColorIndex != -1) dataGridView7.Columns[NacenovanieColorIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
|
|
if (dataGridView7.Columns[e.ColumnIndex].DefaultCellStyle.BackColor == Color.Empty)
|
|
{
|
|
dataGridView7.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.GreenYellow;
|
|
NacenovanieColorIndex = e.ColumnIndex;
|
|
textBox35.Text = "";
|
|
textBox35.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
dataGridView7.Columns[e.ColumnIndex].DefaultCellStyle.BackColor = Color.Empty;
|
|
NacenovanieColorIndex = -1;
|
|
textBox35.Text = "";
|
|
textBox35.Enabled = false;
|
|
}
|
|
*/
|
|
}
|
|
|
|
private void ConfigureFilters(int pocet)
|
|
{
|
|
var queueList = FilterQueue.ToArray();
|
|
var first = string.Empty;
|
|
var second = string.Empty;
|
|
|
|
switch (queueList.Length)
|
|
{
|
|
case 1:
|
|
first = queueList[0] == string.Empty ? string.Empty : queueList[0].ToString();
|
|
break;
|
|
case 2:
|
|
first = queueList[0] == string.Empty ? string.Empty : queueList[0].ToString();
|
|
second = queueList[1] == string.Empty ? string.Empty : queueList[1].ToString();
|
|
break;
|
|
case 0:
|
|
default:
|
|
break;
|
|
}
|
|
|
|
if (first == string.Empty)
|
|
{
|
|
label174.Text = "Stĺpec 1 nevybraný";
|
|
textBox38.Text = "";
|
|
textBox38.Enabled = false;
|
|
//textBox38.Tag = string.Empty;
|
|
}
|
|
else
|
|
{
|
|
label174.Text = first;
|
|
if (pocet > 1) textBox38.Text = textBox52.Text;
|
|
textBox38.Enabled = true;
|
|
//textBox38.Tag = $" AND INSTR(`{first}`, '{textBox38.Text}')>0 ";
|
|
}
|
|
|
|
if (second == string.Empty)
|
|
{
|
|
label227.Text = "Stĺpec 2 nevybraný";
|
|
textBox52.Text = "";
|
|
textBox52.Enabled = false;
|
|
//textBox52.Tag = $" AND INSTR(`{second}`, '{textBox52.Text}')>0 ";
|
|
}
|
|
else
|
|
{
|
|
label227.Text = second;
|
|
textBox52.Text = "";
|
|
textBox52.Enabled = true;
|
|
}
|
|
}
|
|
|
|
private void textBox38_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (textBox38.Text == string.Empty)
|
|
{
|
|
textBox38.Tag = string.Empty;
|
|
}
|
|
else
|
|
{
|
|
textBox38.Tag = $" AND INSTR(`{label174.Text}`, '{textBox38.Text}')>0 ";
|
|
}
|
|
|
|
refreshZiadanky();
|
|
|
|
}
|
|
|
|
private void label174_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (label174.Text.Contains("Stĺpec")) label174.BackColor = Color.Empty;
|
|
else label174.BackColor = Color.Coral;
|
|
}
|
|
|
|
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage19"])
|
|
{
|
|
if (classGlobal.PristupovePrava(classUser.ID, "Ziadanka-schvalit") == false) panel49.Enabled = false;
|
|
if (classGlobal.PristupovePrava(classUser.ID, "Ziadanka-operacie") == false) panel50.Enabled = false;
|
|
}
|
|
}
|
|
|
|
private void button180_Click(object sender, EventArgs e)
|
|
{
|
|
Form frmInventarnaVymena2 = new frmInventarnaVymena();
|
|
frmInventarnaVymena2.ShowDialog();
|
|
}
|
|
|
|
private void button181_Click(object sender, EventArgs e)
|
|
{
|
|
Form frmNacenovanie2 = new frmVybratTypVyhodnotenia();
|
|
frmNacenovanie2.Text = "Naceňovanie - vyhodnocovanie";
|
|
frmNacenovanie2.ShowDialog();
|
|
|
|
RefreshVyhodocovanie();
|
|
}
|
|
|
|
private void label182_Click(object sender, EventArgs e)
|
|
{
|
|
panel68.Size = new Size(36, 35);
|
|
panel68.Location = new Point(this.Size.Width - 45, panel68.Location.Y);
|
|
}
|
|
|
|
private void numericUpDown37_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
refreshSegment(numericUpDown37.Value, numericUpDown38.Value, numericUpDown39.Value);
|
|
}
|
|
|
|
private void refreshSegment(decimal _n1, decimal _n2, decimal _n3)
|
|
{
|
|
decimal x = 0;
|
|
decimal y = 0;
|
|
double uhol = Math.PI / (double)_n3;
|
|
|
|
x = Math.Round(Convert.ToDecimal((double)_n1 * Math.Sin(uhol)), 3);
|
|
y = Math.Round(_n1 / 2 - Convert.ToDecimal((double)_n2 / 2 * Math.Cos(uhol)), 3);
|
|
|
|
label188.Text = x.ToString();
|
|
label190.Text = y.ToString();
|
|
}
|
|
|
|
private void numericUpDown38_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
refreshSegment(numericUpDown37.Value, numericUpDown38.Value, numericUpDown39.Value);
|
|
}
|
|
|
|
private void numericUpDown39_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
refreshSegment(numericUpDown37.Value, numericUpDown38.Value, numericUpDown39.Value);
|
|
}
|
|
|
|
private void numericUpDown40_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
classUser.LimitSqlPrikazu = Convert.ToInt32(numericUpDown40.Value);
|
|
}
|
|
|
|
private void button194_Click(object sender, EventArgs e)
|
|
{
|
|
if (grboxFormulare.Enabled == false) grboxFormulare.Enabled = true;
|
|
else grboxFormulare.Enabled = false;
|
|
}
|
|
|
|
private void textBox45_TextChanged(object sender, EventArgs e)
|
|
{
|
|
string password = "3";
|
|
if (textBox45.Text == password) button194.Enabled = true;
|
|
else
|
|
{
|
|
button194.Enabled = false;
|
|
grboxFormulare.Enabled = false;
|
|
}
|
|
|
|
}
|
|
|
|
private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
textBox46.Text = dataGridView2.SelectedRows[0].Cells["Meno"].Value.ToString();
|
|
textBox47.Text = dataGridView2.SelectedRows[0].Cells["Priezvisko"].Value.ToString();
|
|
textBox48.Text = dataGridView2.SelectedRows[0].Cells["Titul"].Value.ToString();
|
|
textBox49.Text = dataGridView2.SelectedRows[0].Cells["Heslo"].Value.ToString();
|
|
label221.Text = dataGridView2.SelectedRows[0].Cells["OnlineStatus"].Value.ToString();
|
|
label222.Text = dataGridView2.SelectedRows[0].Cells["Status"].Value.ToString();
|
|
label223.Text = dataGridView2.SelectedRows[0].Cells["Zaradenie"].Value.ToString();
|
|
label225.Text = dataGridView2.SelectedRows[0].Cells["PristupovePrava"].Value.ToString();
|
|
if (dataGridView2.SelectedRows[0].Cells["Status"].Value.ToString() == "Aktívny") panel73.BackColor = Color.MintCream;
|
|
if (dataGridView2.SelectedRows[0].Cells["Status"].Value.ToString() == "Neaktívny") panel73.BackColor = Color.MistyRose;
|
|
converToBoolArray(label225.Text);
|
|
rowIndex = dataGridView2.SelectedRows[0].Index;
|
|
|
|
}
|
|
|
|
private void converToBoolArray(string text)
|
|
{
|
|
string heslo = ToBin(Convert.ToInt32(text), 20);
|
|
bool[] hesloArray = heslo.Select(c => c == '1').ToArray();
|
|
|
|
checkBox74.Checked = hesloArray[19];
|
|
checkBox75.Checked = hesloArray[18];
|
|
checkBox76.Checked = hesloArray[17];
|
|
checkBox79.Checked = hesloArray[16];
|
|
checkBox78.Checked = hesloArray[15];
|
|
checkBox77.Checked = hesloArray[14];
|
|
checkBox82.Checked = hesloArray[13];
|
|
checkBox81.Checked = hesloArray[12];
|
|
checkBox80.Checked = hesloArray[11];
|
|
checkBox85.Checked = hesloArray[10];
|
|
checkBox84.Checked = hesloArray[9];
|
|
checkBox83.Checked = hesloArray[8];
|
|
checkBox88.Checked = hesloArray[7];
|
|
checkBox87.Checked = hesloArray[6];
|
|
checkBox86.Checked = hesloArray[5];
|
|
checkBox94.Checked = hesloArray[4];
|
|
checkBox93.Checked = hesloArray[3];
|
|
checkBox92.Checked = hesloArray[2];
|
|
checkBox91.Checked = hesloArray[1];
|
|
checkBox90.Checked = hesloArray[0];
|
|
checkBox89.Checked = false;
|
|
}
|
|
|
|
private string convertToBinary(bool[] array)
|
|
{
|
|
byte[] bitArray = (from x in array select x ? (byte)0x1 : (byte)0x0).ToArray();
|
|
string returnString = "";
|
|
for (int i = bitArray.Length - 1; i > -1; i--)
|
|
{
|
|
returnString += bitArray[i].ToString();
|
|
}
|
|
return returnString;
|
|
}
|
|
|
|
private string convertToInt(string binaryString)
|
|
{
|
|
return Convert.ToInt32(binaryString, 2).ToString();
|
|
}
|
|
|
|
public static string ToBin(int value, int len)
|
|
{
|
|
return (len > 1 ? ToBin(value >> 1, len - 1) : null) + "01"[value & 1];
|
|
}
|
|
|
|
private void button186_Click(object sender, EventArgs e)
|
|
{
|
|
Form frmPridatNastrojeDoSkladu2 = new frmPridatNastrojeDoSkladu();
|
|
frmPridatNastrojeDoSkladu2.ShowDialog();
|
|
refreshEvidenciuBruseni();
|
|
}
|
|
|
|
private void tabPage20_Enter(object sender, EventArgs e)
|
|
{
|
|
refreshEvidenciuBruseni();
|
|
}
|
|
|
|
private void refreshEvidenciuBruseni()
|
|
{
|
|
string cmd = "";
|
|
DataTable tabEvidenciaBruseni = new DataTable();
|
|
cmd = "select * from `mip`.`tab-evidenciabruseni`";
|
|
classSQL.SQL(cmd, out tabEvidenciaBruseni);
|
|
|
|
DataView dvNaSklade = new DataView(tabEvidenciaBruseni);
|
|
DataView dvNaBruseni = new DataView(tabEvidenciaBruseni);
|
|
DataView dvVoVyrobe = new DataView(tabEvidenciaBruseni);
|
|
DataView dvVyradene = new DataView(tabEvidenciaBruseni);
|
|
|
|
string filterNaSklade = "Status = 'Na sklade' AND Typ LIKE '%" + textBox39.Text + "%'";
|
|
dvNaSklade.RowFilter = filterNaSklade;
|
|
string filterNaBruseni = "Status = 'Na brúsení' AND Typ LIKE '%" + textBox41.Text + "%'";
|
|
dvNaBruseni.RowFilter = filterNaBruseni;
|
|
label211.Text = dvNaBruseni.Count.ToString();
|
|
string filterVoVyrobe = "Status = 'Vo výrobe' AND Typ LIKE '%" + textBox43.Text + "%'";
|
|
dvVoVyrobe.RowFilter = filterVoVyrobe;
|
|
string filterVyradene = "Status = 'Vyradený' AND Typ LIKE '%" + textBox42.Text + "%'";
|
|
dvVyradene.RowFilter = filterVyradene;
|
|
|
|
//"City = 'Tokyo' AND (Age < 20 OR Age > 60)" ; Name LIKE '%jo%'"
|
|
|
|
dataGridView20.DataSource = dvNaSklade;
|
|
dataGridView19.DataSource = dvNaBruseni;
|
|
dataGridView21.DataSource = dvVoVyrobe;
|
|
dataGridView22.DataSource = dvVyradene;
|
|
|
|
if (dataGridView21.Rows.Count == 0)
|
|
{
|
|
button182.Enabled = false;
|
|
button185.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
button182.Enabled = true;
|
|
button185.Enabled = true;
|
|
}
|
|
|
|
if (dataGridView20.Rows.Count == 0)
|
|
{
|
|
button184.Enabled = false;
|
|
button189.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
button184.Enabled = true;
|
|
button189.Enabled = true;
|
|
}
|
|
|
|
if (dataGridView19.Rows.Count == 0) button183.Enabled = false;
|
|
else button183.Enabled = true;
|
|
|
|
if (dataGridView21.SelectedRows.Count > 1 || (dataGridView21.SelectedRows.Count != 0 && Convert.ToInt32(dataGridView21.SelectedRows[0].Cells["Počet brúsení"].Value.ToString()) == 0)) button190.Enabled = false;
|
|
else button190.Enabled = true;
|
|
}
|
|
|
|
private void dataGridView19_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
if (dataGridView19.DataSource != null) formatDGV(dataGridView19);
|
|
}
|
|
|
|
private void formatDGV(DataGridView dgv)
|
|
{
|
|
dgv.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dgv.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
dgv.Columns["Index brusenie"].Visible = false;
|
|
dgv.Columns["Dátum zaradenia do výroby"].Visible = false;
|
|
dgv.Columns["Status"].Visible = false;
|
|
|
|
dgv.Columns["Číslo nástroja"].Width = 62;
|
|
dgv.Columns["Typ"].Width = 190;
|
|
dgv.Columns["Počet brúsení"].Width = 60;
|
|
dgv.Columns["Dátum"].Width = 70;
|
|
dgv.Columns["Poznámka"].Width = 165;
|
|
}
|
|
|
|
private void dataGridView20_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
if (dataGridView20.DataSource != null) formatDGV(dataGridView20);
|
|
}
|
|
|
|
private void dataGridView22_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
if (dataGridView22.DataSource != null) formatDGV(dataGridView22);
|
|
}
|
|
|
|
private void dataGridView21_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
dataGridView21.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridView21.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
dataGridView21.Columns["Index brusenie"].Visible = false;
|
|
dataGridView21.Columns["Status"].Visible = false;
|
|
|
|
dataGridView21.Columns["Číslo nástroja"].Width = 62;
|
|
dataGridView21.Columns["Typ"].Width = 190;
|
|
dataGridView21.Columns["Počet brúsení"].Width = 60;
|
|
dataGridView21.Columns["Dátum"].Width = 70;
|
|
dataGridView21.Columns["Poznámka"].Width = 365;
|
|
dataGridView21.Columns["Dátum zaradenia do výroby"].Width = 70;
|
|
}
|
|
|
|
private void dataGridView19_RowEnter(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (dataGridView19.SelectedRows.Count > 0) infoNastroja(dataGridView19.SelectedRows[0]);
|
|
}
|
|
|
|
private void infoNastroja(DataGridViewRow dgvr)
|
|
{
|
|
DateTime dt1 = new DateTime();
|
|
DateTime dt2 = new DateTime();
|
|
string format = "yyyy-MM-dd";
|
|
|
|
//Convert.ToDateTime(dgvr.Cells["Dátum"].Value.ToString());
|
|
|
|
if (dgvr.Cells["Dátum zaradenia do výroby"].Value.ToString() != "")
|
|
{
|
|
dt2 = Convert.ToDateTime(dgvr.Cells["Dátum zaradenia do výroby"].Value.ToString());
|
|
label207.Text = dt2.ToString(format);
|
|
}
|
|
else label207.Text = "";
|
|
|
|
if (dgvr.Cells["Dátum"].Value.ToString() != "")
|
|
{
|
|
dt1 = Convert.ToDateTime(dgvr.Cells["Dátum"].Value.ToString());
|
|
label205.Text = dt1.ToString(format);
|
|
}
|
|
else label205.Text = "";
|
|
|
|
|
|
label197.Text = dgvr.Cells["Číslo nástroja"].Value.ToString();
|
|
label199.Text = dgvr.Cells["Typ"].Value.ToString();
|
|
label201.Text = dgvr.Cells["Počet brúsení"].Value.ToString();
|
|
label203.Text = dgvr.Cells["Status"].Value.ToString();
|
|
label209.Text = dgvr.Cells["Poznámka"].Value.ToString();
|
|
}
|
|
|
|
private void dataGridView20_RowEnter(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (dataGridView20.SelectedRows.Count > 0) infoNastroja(dataGridView20.SelectedRows[0]);
|
|
}
|
|
|
|
private void dataGridView22_RowEnter(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (dataGridView22.SelectedRows.Count > 0) infoNastroja(dataGridView22.SelectedRows[0]);
|
|
}
|
|
|
|
private void dataGridView21_RowEnter(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (dataGridView21.SelectedRows.Count > 0) infoNastroja(dataGridView21.SelectedRows[0]);
|
|
}
|
|
|
|
private void button184_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView20.SelectedRows[0].Cells["Číslo nástroja"].Value.ToString() != "")
|
|
{
|
|
Int32 index = Convert.ToInt32(dataGridView20.SelectedRows[0].Cells["Index brusenie"].Value.ToString());
|
|
string cmd = "update `mip`.`tab-evidenciabruseni` SET `Status` = 'Vo výrobe', `Dátum zaradenia do výroby` = DATE(NOW()), `Číslo nástroja` = "
|
|
+ dataGridView20.SelectedRows[0].Cells["Číslo nástroja"].Value.ToString() + " where `Index brusenie` = " + index.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
refreshEvidenciuBruseni();
|
|
}
|
|
else
|
|
{
|
|
if (panel70.Visible == false) panel70.Visible = true;
|
|
else panel70.Visible = false;
|
|
}
|
|
}
|
|
|
|
private void button188_Click(object sender, EventArgs e)
|
|
{
|
|
panel70.Visible = false;
|
|
textBox40.Clear();
|
|
}
|
|
|
|
private void button187_Click(object sender, EventArgs e)
|
|
{
|
|
Int32 index = Convert.ToInt32(dataGridView20.SelectedRows[0].Cells["Index brusenie"].Value.ToString());
|
|
string cmd = "update `mip`.`tab-evidenciabruseni` SET `Status` = 'Vo výrobe', `Dátum zaradenia do výroby` = DATE(NOW()), `Číslo nástroja` = " + textBox40.Text + " where `Index brusenie` = " + index.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
panel70.Visible = false;
|
|
refreshEvidenciuBruseni();
|
|
}
|
|
|
|
private void panel70_VisibleChanged(object sender, EventArgs e)
|
|
{
|
|
if (panel70.Visible == true)
|
|
{
|
|
string cmd = "";
|
|
string typ = dataGridView20.SelectedRows[0].Cells["Typ"].Value.ToString();
|
|
cmd = "select ifnull(max(`Číslo nástroja`),0) as `Max` from `tab-evidenciabruseni` where `Typ` = '" + typ + "';";
|
|
string max;
|
|
classSQL.SQL(cmd, out max);
|
|
label210.Text = max;
|
|
textBox40.Text = (1 + Convert.ToInt32(max)).ToString();
|
|
button187.Focus();
|
|
}
|
|
}
|
|
|
|
private void textBox40_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
int intResult;
|
|
if (!(int.TryParse(textBox40.Text + e.KeyChar, out intResult)) && (int)e.KeyChar != 8) e.KeyChar = '\0';
|
|
|
|
}
|
|
|
|
private void textBox40_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (textBox40.Text != "")
|
|
{
|
|
if (Convert.ToInt32(textBox40.Text) - Convert.ToInt32(label210.Text) == 1) button187.Enabled = true;
|
|
else button187.Enabled = false;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void textBox39_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshEvidenciuBruseni();
|
|
}
|
|
|
|
private void textBox43_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshEvidenciuBruseni();
|
|
}
|
|
|
|
private void textBox42_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshEvidenciuBruseni();
|
|
}
|
|
|
|
private void textBox41_TextChanged(object sender, EventArgs e)
|
|
{
|
|
refreshEvidenciuBruseni();
|
|
}
|
|
|
|
private void button189_Click(object sender, EventArgs e)
|
|
{
|
|
if (MessageBox.Show("Naozaj vyradiť nástroj zo skladu?", "Vyradiť nástroj??", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
Int32 index = Convert.ToInt32(dataGridView20.SelectedRows[0].Cells["Index brusenie"].Value.ToString());
|
|
string cmd = "update `mip`.`tab-evidenciabruseni` SET `Status` = 'Vyradený', `Dátum` = DATE(NOW()) where `Index brusenie` = " + index.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
refreshEvidenciuBruseni();
|
|
}
|
|
}
|
|
|
|
private void button185_Click(object sender, EventArgs e)
|
|
{
|
|
if (MessageBox.Show("Naozaj vyradiť nástroj číslo " + dataGridView21.SelectedRows[0].Cells["Číslo nástroja"].Value.ToString() + " z výroby?", "Vyradiť nástroj??", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
Int32 index = Convert.ToInt32(dataGridView21.SelectedRows[0].Cells["Index brusenie"].Value.ToString());
|
|
string cmd = "update `mip`.`tab-evidenciabruseni` SET `Status` = 'Vyradený', `Dátum` = DATE(NOW()) where `Index brusenie` = " + index.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
refreshEvidenciuBruseni();
|
|
}
|
|
}
|
|
|
|
private void button182_Click(object sender, EventArgs e)
|
|
{
|
|
Int32 index = 0;
|
|
for (int i = 0; i < dataGridView21.SelectedRows.Count; i++)
|
|
{
|
|
index = Convert.ToInt32(dataGridView21.SelectedRows[i].Cells["Index brusenie"].Value.ToString());
|
|
string cmd = "update `mip`.`tab-evidenciabruseni` SET `Status` = 'Na brúsení', `Dátum` = DATE(NOW()) where `Index brusenie` = " + index.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
}
|
|
refreshEvidenciuBruseni();
|
|
|
|
}
|
|
|
|
private void button183_Click(object sender, EventArgs e)
|
|
{
|
|
Int32 index = 0;
|
|
Int32 pocet = 0;
|
|
for (int i = 0; i < dataGridView19.SelectedRows.Count; i++)
|
|
{
|
|
index = Convert.ToInt32(dataGridView19.SelectedRows[i].Cells["Index brusenie"].Value.ToString());
|
|
pocet = Convert.ToInt32(dataGridView19.SelectedRows[i].Cells["Počet brúsení"].Value.ToString()) + 1;
|
|
string cmd = "update `mip`.`tab-evidenciabruseni` SET `Status` = 'Vo výrobe', `Dátum` = DATE(NOW()), `Počet brúsení` = " + pocet.ToString() + " where `Index brusenie` = " + index.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
}
|
|
refreshEvidenciuBruseni();
|
|
|
|
}
|
|
|
|
private void button190_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView21.SelectedRows.Count != 0)
|
|
{
|
|
Int32 index = 0;
|
|
Int32 pocet = 0;
|
|
|
|
index = Convert.ToInt32(dataGridView21.SelectedRows[0].Cells["Index brusenie"].Value.ToString());
|
|
pocet = Convert.ToInt32(dataGridView21.SelectedRows[0].Cells["Počet brúsení"].Value.ToString()) - 1;
|
|
string cmd = "update `mip`.`tab-evidenciabruseni` SET `Počet brúsení` = " + pocet.ToString() + " where `Index brusenie` = " + index.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
|
|
refreshEvidenciuBruseni();
|
|
}
|
|
}
|
|
|
|
private void dataGridView21_SelectionChanged(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView21.SelectedRows.Count > 1 || (dataGridView21.SelectedRows.Count != 0 && Convert.ToInt32(dataGridView21.SelectedRows[0].Cells["Počet brúsení"].Value.ToString()) == 0)) button190.Enabled = false;
|
|
else button190.Enabled = true;
|
|
}
|
|
|
|
private void dataGridView19_SelectionChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void dataGridView20_SelectionChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void dataGridView22_SelectionChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void button193_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView21.SelectedRows.Count == 1)
|
|
{
|
|
if (panel71.Visible == false) panel71.Visible = true;
|
|
else panel71.Visible = false;
|
|
}
|
|
else panel71.Visible = false;
|
|
}
|
|
|
|
private void button191_Click(object sender, EventArgs e)
|
|
{
|
|
panel71.Visible = false;
|
|
textBox44.Clear();
|
|
}
|
|
|
|
private void panel71_VisibleChanged(object sender, EventArgs e)
|
|
{
|
|
if (panel71.Visible == true)
|
|
{
|
|
label213.Text = dataGridView21.SelectedRows[0].Cells["Počet brúsení"].Value.ToString();
|
|
textBox40.Text = "";
|
|
button192.Focus();
|
|
}
|
|
}
|
|
|
|
private void textBox44_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
int intResult;
|
|
if (!(int.TryParse(textBox44.Text + e.KeyChar, out intResult)) && (int)e.KeyChar != 8) e.KeyChar = '\0';
|
|
}
|
|
|
|
private void textBox44_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (textBox44.Text != "")
|
|
{
|
|
if (Convert.ToInt32(textBox44.Text) > 0) button192.Enabled = true;
|
|
else button192.Enabled = false;
|
|
}
|
|
}
|
|
|
|
private void button192_Click(object sender, EventArgs e)
|
|
{
|
|
Int32 index = Convert.ToInt32(dataGridView21.SelectedRows[0].Cells["Index brusenie"].Value.ToString());
|
|
string cmd = "update `mip`.`tab-evidenciabruseni` SET `Počet brúsení` = " + textBox44.Text + " where `Index brusenie` = " + index.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
panel71.Visible = false;
|
|
textBox44.Clear();
|
|
refreshEvidenciuBruseni();
|
|
}
|
|
|
|
private void button195_Click(object sender, EventArgs e)
|
|
{
|
|
//uložiť uzívateľa
|
|
|
|
}
|
|
|
|
private void dataGridView20_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
|
{
|
|
if (e.RowIndex != -1)
|
|
{
|
|
if (bool_ZobrazVstupBruseniePoznamka == false)
|
|
{
|
|
intBrusenieIndex = Convert.ToInt32(dataGridView20.Rows[e.RowIndex].Cells["Index brusenie"].Value);
|
|
PoznamkaText = dataGridView20.Rows[e.RowIndex].Cells["Poznámka"].Value.ToString();
|
|
bool_ZobrazVstupBruseniePoznamka = true;
|
|
ZobrazVstupBruseniePoznamka(/*e.RowIndex*/);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
bool bool_ZobrazVstupBruseniePoznamka = false;
|
|
Button lBrusenieButton;
|
|
Panel pBruseniePoznamka;
|
|
Int32 intBrusenieIndex = 0;
|
|
string PoznamkaText = "";
|
|
|
|
private void ZobrazVstupBruseniePoznamka(/*Int32 eRI*/)
|
|
{
|
|
TextBox lTextBoxPoznamka = new TextBox();
|
|
lTextBoxPoznamka.Size = new Size(150, 20);
|
|
lTextBoxPoznamka.Location = new Point(1, 1);
|
|
lTextBoxPoznamka.Text = PoznamkaText;
|
|
lTextBoxPoznamka.TextChanged += new EventHandler(lTextBoxPoznamkaChanged);
|
|
|
|
lBrusenieButton = new Button();
|
|
lBrusenieButton.Size = new Size(100, 22);
|
|
lBrusenieButton.Location = new Point(151, 0);
|
|
lBrusenieButton.Text = "Uložiť poznámku";
|
|
|
|
pBruseniePoznamka = new Panel();
|
|
pBruseniePoznamka.Size = new Size(253, 24);
|
|
pBruseniePoznamka.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
pBruseniePoznamka.Name = "pBruseniePoznamka";
|
|
|
|
int x = 0; int y = 0;
|
|
if (MousePosition.X + pBruseniePoznamka.Width + 50 > this.Width) x = MousePosition.X - pBruseniePoznamka.Width;
|
|
else x = MousePosition.X;
|
|
if (MousePosition.Y + pBruseniePoznamka.Height + 70 > this.Height) y = MousePosition.Y - pBruseniePoznamka.Height;
|
|
else y = MousePosition.Y;
|
|
pBruseniePoznamka.Location = new Point(x - 10, y - 25);
|
|
|
|
pBruseniePoznamka.Controls.Add(lBrusenieButton);
|
|
pBruseniePoznamka.Controls.Add(lTextBoxPoznamka);
|
|
this.Controls.Add(pBruseniePoznamka);
|
|
lBrusenieButton.Focus();
|
|
|
|
|
|
lBrusenieButton.Click += new EventHandler(SaveClosePanelBruseniePoznamka);
|
|
pBruseniePoznamka.Leave += new EventHandler(pBruseniePoznamka_Leave);
|
|
|
|
pBruseniePoznamka.BringToFront();
|
|
}
|
|
|
|
private void pBruseniePoznamka_Leave(object sender, EventArgs e)
|
|
{
|
|
lBrusenieButton.Click -= new EventHandler(SaveClosePanelBruseniePoznamka);
|
|
pBruseniePoznamka.Leave -= new EventHandler(pBruseniePoznamka_Leave);
|
|
bool_ZobrazVstupBruseniePoznamka = false;
|
|
this.Controls.Remove(pBruseniePoznamka);
|
|
|
|
|
|
}
|
|
|
|
void SaveClosePanelBruseniePoznamka(object sender, EventArgs e)
|
|
{
|
|
string cmd = "";
|
|
|
|
cmd = "update `mip`.`tab-evidenciabruseni` SET `Poznámka` = '" + PoznamkaText + "' where `Index brusenie` = " + intBrusenieIndex.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
|
|
PoznamkaText = "";
|
|
lBrusenieButton.Click -= new EventHandler(SaveClosePanelBruseniePoznamka);
|
|
this.Controls.Remove(pBruseniePoznamka);
|
|
bool_ZobrazVstupBruseniePoznamka = false;
|
|
|
|
}
|
|
|
|
void lTextBoxPoznamkaChanged(object sender, EventArgs e)
|
|
{
|
|
TextBox tb = sender as TextBox;
|
|
|
|
if (tb.Text != "") PoznamkaText = tb.Text;
|
|
else PoznamkaText = "";
|
|
|
|
}
|
|
|
|
private void dataGridView19_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
|
{
|
|
if (e.RowIndex != -1)
|
|
{
|
|
if (bool_ZobrazVstupBruseniePoznamka == false)
|
|
{
|
|
intBrusenieIndex = Convert.ToInt32(dataGridView19.Rows[e.RowIndex].Cells["Index brusenie"].Value);
|
|
PoznamkaText = dataGridView19.Rows[e.RowIndex].Cells["Poznámka"].Value.ToString();
|
|
bool_ZobrazVstupBruseniePoznamka = true;
|
|
ZobrazVstupBruseniePoznamka(/*e.RowIndex*/);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void dataGridView21_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
|
{
|
|
if (e.RowIndex != -1)
|
|
{
|
|
if (bool_ZobrazVstupBruseniePoznamka == false)
|
|
{
|
|
intBrusenieIndex = Convert.ToInt32(dataGridView21.Rows[e.RowIndex].Cells["Index brusenie"].Value);
|
|
PoznamkaText = dataGridView21.Rows[e.RowIndex].Cells["Poznámka"].Value.ToString();
|
|
bool_ZobrazVstupBruseniePoznamka = true;
|
|
ZobrazVstupBruseniePoznamka(/*e.RowIndex*/);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void dataGridView22_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
{
|
|
if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
|
{
|
|
if (e.RowIndex != -1)
|
|
{
|
|
if (bool_ZobrazVstupBruseniePoznamka == false)
|
|
{
|
|
intBrusenieIndex = Convert.ToInt32(dataGridView22.Rows[e.RowIndex].Cells["Index brusenie"].Value);
|
|
PoznamkaText = dataGridView22.Rows[e.RowIndex].Cells["Poznámka"].Value.ToString();
|
|
bool_ZobrazVstupBruseniePoznamka = true;
|
|
ZobrazVstupBruseniePoznamka(/*e.RowIndex*/);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void dataGridView19_CellMouseClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void refreshPristup()
|
|
{
|
|
bool[] checkBoxValues =
|
|
{
|
|
checkBox74.Checked,
|
|
checkBox75.Checked,
|
|
checkBox76.Checked,
|
|
checkBox79.Checked,
|
|
checkBox78.Checked,
|
|
checkBox77.Checked,
|
|
checkBox82.Checked,
|
|
checkBox81.Checked,
|
|
checkBox80.Checked,
|
|
checkBox85.Checked,
|
|
checkBox84.Checked,
|
|
checkBox83.Checked,
|
|
checkBox88.Checked,
|
|
checkBox87.Checked,
|
|
checkBox86.Checked,
|
|
checkBox94.Checked,
|
|
checkBox93.Checked,
|
|
checkBox92.Checked,
|
|
checkBox91.Checked,
|
|
checkBox90.Checked
|
|
//checkBox89.Checked
|
|
};
|
|
label225.Text = convertToInt(convertToBinary(checkBoxValues));
|
|
}
|
|
|
|
private void checkBox75_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox76_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox79_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox78_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox77_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox82_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox81_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox80_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox85_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox84_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox83_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox88_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox87_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox86_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox94_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox93_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox92_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox91_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox90_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox89_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void checkBox74_Click(object sender, EventArgs e)
|
|
{
|
|
refreshPristup();
|
|
}
|
|
|
|
private void label222_Click(object sender, EventArgs e)
|
|
{
|
|
if (label222.Text == "Neaktívny")
|
|
{
|
|
label222.Text = "Aktívny";
|
|
panel73.BackColor = Color.MintCream;
|
|
}
|
|
else
|
|
{
|
|
label222.Text = "Neaktívny";
|
|
panel73.BackColor = Color.MistyRose;
|
|
}
|
|
}
|
|
|
|
private void label223_Click(object sender, EventArgs e)
|
|
{
|
|
if (label223.Text == "Administratíva") label223.Text = "Výroba";
|
|
else label223.Text = "Administratíva";
|
|
}
|
|
|
|
private void button195_Click_1(object sender, EventArgs e)
|
|
{
|
|
classSQL.SQL("UPDATE `mip`.`tabusers` SET `OnlineStatus`='Offline' WHERE `IDUsers`=" + classUser.ID + ";");
|
|
string cmd = "";
|
|
cmd = "UPDATE `mip`.`tabusers` SET "
|
|
+ "`Meno` = '" + textBox46.Text
|
|
+ "', `Priezvisko` = '" + textBox47.Text
|
|
+ "', `Titul` = '" + textBox48.Text
|
|
+ "', `Heslo` = '" + textBox49.Text
|
|
+ "', `OnlineStatus` = '" + label221.Text
|
|
+ "', `PristupovePrava` = " + label225.Text
|
|
+ ", `Status` = '" + label222.Text
|
|
+ "', `Zaradenie` = '" + label223.Text
|
|
+ "' WHERE `IDUsers` = " + dataGridView2.SelectedRows[0].Cells["IDUsers"].Value.ToString() + ";";
|
|
|
|
classSQL.SQL(cmd);
|
|
btnObnovit_Click(null, null);
|
|
}
|
|
|
|
private void textBox50_TextChanged(object sender, EventArgs e)
|
|
{
|
|
string password = "kompozitum2017";
|
|
if (textBox50.Text == password) button196.Enabled = true;
|
|
else
|
|
{
|
|
button196.Enabled = false;
|
|
groupBox1.Enabled = false;
|
|
panel73.Enabled = false;
|
|
}
|
|
}
|
|
|
|
private void button196_Click(object sender, EventArgs e)
|
|
{
|
|
if (groupBox1.Enabled == false) { groupBox1.Enabled = true; panel73.Enabled = true; if (dataGridView2.RowCount == 0) btnObnovit_Click(null, null); }
|
|
else { groupBox1.Enabled = false; panel73.Enabled = false; }
|
|
}
|
|
|
|
private void button197_Click(object sender, EventArgs e)
|
|
{
|
|
//vratit na sklad
|
|
if (dataGridView22.SelectedRows.Count > 0)
|
|
{
|
|
Int32 index = Convert.ToInt32(dataGridView22.SelectedRows[0].Cells["Index brusenie"].Value.ToString());
|
|
string cmd = "update `mip`.`tab-evidenciabruseni` SET `Status` = 'Na sklade', `Dátum` = DATE(NOW()) where `Index brusenie` = " + index.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
refreshEvidenciuBruseni();
|
|
}
|
|
}
|
|
|
|
private void button198_Click(object sender, EventArgs e)
|
|
{
|
|
//vratit do vyroby
|
|
if (dataGridView22.SelectedRows.Count > 0)
|
|
{
|
|
Int32 index = Convert.ToInt32(dataGridView22.SelectedRows[0].Cells["Index brusenie"].Value.ToString());
|
|
string cmd = "update `mip`.`tab-evidenciabruseni` SET `Status` = 'Vo výrobe', `Dátum` = DATE(NOW()) where `Index brusenie` = " + index.ToString() + ";";
|
|
classSQL.SQL(cmd);
|
|
refreshEvidenciuBruseni();
|
|
}
|
|
|
|
}
|
|
|
|
private void button201_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView7.SelectedRows.Count != 0)
|
|
{
|
|
if (dataGridView7.SelectedRows[0].Cells["Status"].Value.ToString() != "Nacenená")
|
|
{
|
|
if (panel75.Visible == false)
|
|
{
|
|
textBox51.Text = dataGridView7.SelectedRows[0].Cells["Poznámka2"].Value.ToString();
|
|
panel75.Visible = true;
|
|
}
|
|
else panel75.Visible = false;
|
|
}
|
|
else MessageBox.Show("Záznam bol nacenený, nedá sa editovať!");
|
|
}
|
|
else MessageBox.Show("Žiadne nacenenie nebolo vybrané na editovanie!");
|
|
}
|
|
|
|
private void button200_Click(object sender, EventArgs e)
|
|
{
|
|
panel75.Visible = false;
|
|
string cmd = "UPDATE `mip`.`tab-nacenovanie` SET `Poznamka2`= '" + textBox51.Text + "' WHERE `IDNacenovanie`= " + dataGridView7.SelectedRows[0].Cells["IDNacenovanie"].Value.ToString() + "; ";
|
|
classSQL.SQL(cmd);
|
|
MessageBox.Show("Poznámka upravená!");
|
|
refreshNacenovanie();
|
|
}
|
|
|
|
private void button199_Click(object sender, EventArgs e)
|
|
{
|
|
panel75.Visible = false;
|
|
}
|
|
|
|
private void labelVsetkyAleboMeskajuce_Click(object sender, EventArgs e)
|
|
{
|
|
var label = sender as Label;
|
|
if (Convert.ToBoolean(label.Tag) == true)
|
|
{
|
|
label.Tag = false;
|
|
label.Text = "Meškajúce";
|
|
refreshNepotvrdeneNedoruceneZiadanky();
|
|
}
|
|
else
|
|
{
|
|
label.Tag = true;
|
|
label.Text = "Všetky";
|
|
refreshZiadanky();
|
|
}
|
|
}
|
|
|
|
private void dataGridView16_SelectionChanged(object sender, EventArgs e)
|
|
{
|
|
if (ReloadSelected)
|
|
{
|
|
var ids = dataGridView16.SelectedRows.Cast<DataGridViewRow>().Select(x => x.Cells["IDZiadanka"].Value.ToString()).ToList();
|
|
var grigIds = dataGridView16.SelectedRows.Cast<DataGridViewRow>().Select(y => y.Index.ToString()).ToList();
|
|
SelectedIds = String.Join(", ", ids);
|
|
SelectedZiadankaGridIds = String.Join(", ", grigIds);
|
|
if (ids?.Count > 0)
|
|
{
|
|
button130.Enabled = true;
|
|
button155.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
button130.Enabled = false;
|
|
button155.Enabled = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void textBox52_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (textBox52.Text == string.Empty)
|
|
{
|
|
textBox52.Tag = string.Empty;
|
|
}
|
|
else
|
|
{
|
|
textBox52.Tag = $" AND INSTR(`{label227.Text}`, '{textBox52.Text}')>0 ";
|
|
}
|
|
|
|
refreshZiadanky();
|
|
}
|
|
|
|
private void label227_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (label227.Text.Contains("Stĺpec")) label227.BackColor = Color.Empty;
|
|
else label227.BackColor = Color.Coral;
|
|
}
|
|
|
|
private void button202_Click(object sender, EventArgs e)
|
|
{
|
|
label174.Text = "Stĺpec 1 nevybraný";
|
|
label227.Text = "Stĺpec 2 nevybraný";
|
|
textBox38.Text = "";
|
|
textBox38.Enabled = false;
|
|
textBox52.Text = "";
|
|
textBox52.Enabled = false;
|
|
FilterQueue.Clear();
|
|
}
|
|
|
|
private void button150_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView8.SelectedRows.Count == 1)
|
|
{
|
|
DateTime dtZacatie = Convert.ToDateTime(dataGridView8.SelectedRows[0].Cells["CasZacatia"].Value);
|
|
DateTime dtUkoncenie = Convert.ToDateTime(dataGridView8.SelectedRows[0].Cells["CasUkoncenia"].Value);
|
|
|
|
var IdUdrzbaSelected = Convert.ToInt32(dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["IDUdrzba"].Value).ToString();
|
|
|
|
|
|
panelPridatUdrzbu.Visible = true;
|
|
|
|
comboBox8.Text = dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["Dielna"].Value.ToString();
|
|
comboBox6.Text = dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["Stroj"].Value.ToString();
|
|
comboBox5.Text = dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["Operacia"].Value.ToString();
|
|
|
|
comboBox15.SelectedValue = IdUdrzbaSelected;
|
|
comboBox7.Text = dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["NazovFirmy"].Value.ToString();
|
|
dateTimePicker5.Value = dtZacatie.Date;
|
|
numericUpDown22.Value = dtZacatie.Hour;
|
|
numericUpDown21.Value = dtZacatie.Minute;
|
|
dateTimePicker2.Value = dtUkoncenie.Date;
|
|
numericUpDown17.Value = dtUkoncenie.Hour;
|
|
numericUpDown18.Value = dtUkoncenie.Minute;
|
|
textBox21.Text = dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["Cena"].Value.ToString();
|
|
textBox20.Text = dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["Poznamka"].Value.ToString();
|
|
textBox3.Text = dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["CisloDokladu"].Value.ToString();
|
|
button70.Tag = dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["IDPUOPR"].Value.ToString();
|
|
button70.Text = "Uložiť záznam";
|
|
}
|
|
|
|
else
|
|
{
|
|
panel56.Visible = false;
|
|
MessageBox.Show("Musí byť vybraný presne jeden záznam na editáciu!");
|
|
}
|
|
|
|
refreshUdrzby();
|
|
}
|
|
|
|
private void button203_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView8.SelectedRows.Count == 1)
|
|
{
|
|
if (MessageBox.Show("Naozaj vymazať vybraný záznam údržby/opravy?", $"Vymazanie záznamu pre stroj : {dataGridView8.Rows[dataGridView8.SelectedRows[0].Index].Cells["Stroj"].Value.ToString()}", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
string cmdDelete = $"DELETE FROM `mip`.`tabudrzbyaopravy` WHERE `IDPUOPR` = {dataGridView8.SelectedRows[0].Cells["IDPUOPR"].Value.ToString()};";
|
|
classSQL.SQL(cmdDelete);
|
|
}
|
|
refreshUdrzby();
|
|
}
|
|
else
|
|
{
|
|
panel56.Visible = false;
|
|
MessageBox.Show("Musí byť vybraný presne jeden záznam na editáciu!");
|
|
}
|
|
}
|
|
|
|
private void dataGridView8_SelectionChanged(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView8.SelectedRows.Count == 1)
|
|
{
|
|
if (dataGridView8.SelectedRows[0].Cells["CasUkoncenia"].Value.ToString() == string.Empty)
|
|
{
|
|
button150.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
button150.Enabled = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void textBox21_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
float floatResult;
|
|
if (e.KeyChar == '.') e.KeyChar = ',';
|
|
if (!(float.TryParse(textBox21.Text + e.KeyChar, out floatResult)) && (int)e.KeyChar != 8) e.KeyChar = '\0';
|
|
}
|
|
|
|
private void button204_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView12.SelectedRows.Count == 1)
|
|
{
|
|
var IDVyrobok = Convert.ToInt32(dataGridView12.SelectedRows[0].Cells["IDVyrobok"].Value);
|
|
// ulozi polotovar do tabpolotovar
|
|
var frmUlozPolotovarZVyroby = new frmUlozPolotovarZVyroby(IDVyrobok);
|
|
if (frmUlozPolotovarZVyroby.ShowDialog() == DialogResult.OK)
|
|
{
|
|
dataGridView12.SelectedRows[0].Cells["RozmerPolotovaru"].Value = frmUlozPolotovarZVyroby.VelkostPolotovaru;
|
|
button204.Text = "Upraviť polotovar";
|
|
}
|
|
|
|
frmUlozPolotovarZVyroby.Dispose();
|
|
}
|
|
|
|
}
|
|
|
|
private void dataGridView12_SelectionChanged(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView12.SelectedRows.Count == 1)
|
|
{
|
|
if (dataGridView12.SelectedRows[0].Cells["RozmerPolotovaru"].Value.ToString() == string.Empty)
|
|
{
|
|
button204.Text = "Pridať polotovar";
|
|
}
|
|
else
|
|
{
|
|
button204.Text = "Upraviť polotovar";
|
|
}
|
|
}
|
|
}
|
|
|
|
private void tabPage13_Enter(object sender, EventArgs e)
|
|
{
|
|
RefreshVyhodocovanie();
|
|
}
|
|
|
|
private void RefreshVyhodocovanie()
|
|
{
|
|
string sqlCommandVyhodocovanie;
|
|
sqlCommandVyhodocovanie = @"SELECT * FROM `pohladvyhodnocovanie`;";
|
|
DataTable dtbVyhodocovanie = new DataTable();
|
|
classSQL.SQL(sqlCommandVyhodocovanie, out dtbVyhodocovanie);
|
|
|
|
dataGridViewVyhodnocovanie.DataSource = null;
|
|
dataGridViewVyhodnocovanie.DataSource = dtbVyhodocovanie;
|
|
dataGridViewVyhodnocovanie.Visible = true;
|
|
dataGridViewVyhodnocovanie.AutoResizeColumns();
|
|
FormatDgViewVyhodnocovanie();
|
|
//FormatColorsVyhodnocovanie();
|
|
}
|
|
|
|
private void FormatColorsVyhodnocovanie()
|
|
{
|
|
for (int i = 0; i < dataGridViewVyhodnocovanie.Rows.Count; i++)
|
|
{
|
|
var kontrolovanyZisk = Convert.ToDecimal(dataGridViewVyhodnocovanie.Rows[i].Cells["Vyhodnotený zisk"].Value);
|
|
var intSwitch = kontrolovanyZisk < 0 ? -1 : kontrolovanyZisk >= 25 ? 1 : 0;
|
|
switch (intSwitch)
|
|
{
|
|
case -1:
|
|
dataGridViewVyhodnocovanie.Rows[i].DefaultCellStyle.BackColor = Color.LightPink;
|
|
break;
|
|
case 0:
|
|
dataGridViewVyhodnocovanie.Rows[i].DefaultCellStyle.BackColor = Color.LightYellow;
|
|
break;
|
|
case 1:
|
|
dataGridViewVyhodnocovanie.Rows[i].DefaultCellStyle.BackColor = Color.LightGreen;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void FormatDgViewVyhodnocovanie()
|
|
{
|
|
dataGridViewVyhodnocovanie.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
dataGridViewVyhodnocovanie.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
dataGridViewVyhodnocovanie.Columns["IDDopyt"].Visible = false;
|
|
dataGridViewVyhodnocovanie.Columns["IDNacenovanie"].Visible = false;
|
|
dataGridViewVyhodnocovanie.Columns["IdVyrobokVyhodnocovanie"].Visible = false;
|
|
dataGridViewVyhodnocovanie.Columns["IdUser"].Visible = false;
|
|
dataGridViewVyhodnocovanie.Columns["IdVyhodnotenie"].Visible = false;
|
|
}
|
|
|
|
private void dataGridViewVyhodnocovanie_DataSourceChanged(object sender, EventArgs e)
|
|
{
|
|
FormatColorsVyhodnocovanie();
|
|
}
|
|
|
|
private void button205_Click(object sender, EventArgs e)
|
|
{
|
|
var idNacenovanie = Convert.ToInt32(dataGridViewVyhodnocovanie.SelectedRows[0].Cells["IDNacenovanie"].Value);
|
|
var idVyrobok = Convert.ToInt32(dataGridViewVyhodnocovanie.SelectedRows[0].Cells["IdVyrobokVyhodnocovanie"].Value);
|
|
var idVyhodnotenie = Convert.ToInt32(dataGridViewVyhodnocovanie.SelectedRows[0].Cells["IdVyhodnotenie"].Value);
|
|
|
|
Form frmNacenovanie2 = new frmNacenovanie(idNacenovanie, idVyrobok, true, true, false, false, false, false, idVyhodnotenie);
|
|
frmNacenovanie2.Text = "Vyhodnocovanie";
|
|
frmNacenovanie2.ShowDialog();
|
|
RefreshVyhodocovanie();
|
|
}
|
|
|
|
private void dataGridViewVyhodnocovanie_SelectionChanged(object sender, EventArgs e)
|
|
{
|
|
if (dataGridViewVyhodnocovanie.SelectedRows.Count > 0)
|
|
{
|
|
button205.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
button205.Enabled = false;
|
|
}
|
|
}
|
|
|
|
private void button206_Click(object sender, EventArgs e)
|
|
{
|
|
//
|
|
DataGridViewRow dtgvr = dataGridView7.SelectedRows[0];
|
|
|
|
var idNacenovanie = Convert.ToInt32(dtgvr.Cells["IDNacenovanie"].Value);
|
|
var idVyrobok = Convert.ToInt32(dtgvr.Cells["IDVyrobokNac"].Value);
|
|
var idVyhodnotenie = Convert.ToInt32(dtgvr.Cells["IdVyhodnotenie"].Value);
|
|
|
|
Form frmNacenovanie2 = new frmNacenovanie(idNacenovanie, idVyrobok, true, true, false, false, false, false, idVyhodnotenie);
|
|
frmNacenovanie2.Text = "Vyhodnocovanie";
|
|
frmNacenovanie2.ShowDialog();
|
|
RefreshVyhodocovanie();
|
|
}
|
|
|
|
private void button207_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
DataGridViewRow dtgvr = dataGridView7.SelectedRows[0];
|
|
|
|
var idNacenovanie = Convert.ToInt32(dtgvr.Cells["IDNacenovanie"].Value);
|
|
var idVyrobok = Convert.ToInt32(dtgvr.Cells["IDVyrobokNac"].Value);
|
|
|
|
var cmd = $@"INSERT INTO `mip`.`tab-nacenovanie-vyhodnocovanie` (
|
|
`IDNacenovanie`,
|
|
`IdVyrobokVyhodnocovanie`,
|
|
`Status`)
|
|
VALUES (
|
|
{idNacenovanie},
|
|
{idVyrobok},
|
|
'Žiadosť o vyhodnotenie');";
|
|
|
|
if (cmd != "") classSQL.SQL(cmd);
|
|
|
|
refreshNacenovanie();
|
|
}
|
|
}
|
|
}
|