This commit is contained in:
chikyun.kim
2018-10-30 17:29:21 +09:00
parent 0878e80f14
commit 45a3def8e1
16 changed files with 670 additions and 364 deletions

View File

@@ -90,8 +90,9 @@
this.editDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.viewThisUserDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.lbStt = new System.Windows.Forms.ToolStripLabel();
this.cmDate = new System.Windows.Forms.ToolStripComboBox();
this.dtSD = new System.Windows.Forms.ToolStripTextBox();
this.lbEnd = new System.Windows.Forms.ToolStripLabel();
this.dtED = new System.Windows.Forms.ToolStripTextBox();
@@ -345,9 +346,10 @@
this.copyDataToolStripMenuItem,
this.editDataToolStripMenuItem,
this.toolStripMenuItem2,
this.viewThisUserDataToolStripMenuItem});
this.viewThisUserDataToolStripMenuItem,
this.exportDataToolStripMenuItem});
this.cm1.Name = "contextMenuStrip1";
this.cm1.Size = new System.Drawing.Size(337, 184);
this.cm1.Size = new System.Drawing.Size(337, 226);
//
// columnSizeToolStripMenuItem
//
@@ -423,10 +425,17 @@
this.viewThisUserDataToolStripMenuItem.Text = "View This User data";
this.viewThisUserDataToolStripMenuItem.Click += new System.EventHandler(this.viewThisUserDataToolStripMenuItem_Click);
//
// exportDataToolStripMenuItem
//
this.exportDataToolStripMenuItem.Name = "exportDataToolStripMenuItem";
this.exportDataToolStripMenuItem.Size = new System.Drawing.Size(336, 42);
this.exportDataToolStripMenuItem.Text = "Export List";
this.exportDataToolStripMenuItem.Click += new System.EventHandler(this.exportDataToolStripMenuItem_Click);
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.lbStt,
this.cmDate,
this.dtSD,
this.lbEnd,
this.dtED,
@@ -443,12 +452,15 @@
this.toolStrip1.TabIndex = 3;
this.toolStrip1.Text = "toolStrip1";
//
// lbStt
// cmDate
//
this.lbStt.Name = "lbStt";
this.lbStt.Size = new System.Drawing.Size(41, 22);
this.lbStt.Text = "Period";
this.lbStt.Click += new System.EventHandler(this.lbStt_Click);
this.cmDate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmDate.Items.AddRange(new object[] {
"Date",
"InDate",
"ExpDate"});
this.cmDate.Name = "cmDate";
this.cmDate.Size = new System.Drawing.Size(75, 25);
//
// dtSD
//
@@ -744,7 +756,6 @@
private System.Windows.Forms.ToolStripButton bindingNavigatorMoveLastItem;
private System.Windows.Forms.ToolStripSeparator bindingNavigatorSeparator2;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripLabel lbStt;
private System.Windows.Forms.ToolStripTextBox dtSD;
private System.Windows.Forms.ToolStripLabel lbEnd;
private System.Windows.Forms.ToolStripTextBox dtED;
@@ -778,5 +789,7 @@
private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem;
private System.Windows.Forms.ToolStripButton btEdit;
private FarPoint.Win.Spread.SheetView sheetView1;
private System.Windows.Forms.ToolStripMenuItem exportDataToolStripMenuItem;
private System.Windows.Forms.ToolStripComboBox cmDate;
}
}

View File

@@ -20,9 +20,44 @@ namespace FEQ0000
fn_fpcolsize = util.MakeFilePath(util.CurrentPath, "formSetting", "fp_" + this.Name + ".ini");
this.dsPurchase.Purchase.TableNewRow += Purchase_TableNewRow;
this.FormClosed += __Closed;
dtSD.KeyDown += dtSD_KeyDown;
dtED.KeyDown += dtSD_KeyDown;
//this.dv1.CellFormatting += dv1_CellFormatting;
}
void dtSD_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode != Keys.Enter) return;
var tb = sender as ToolStripTextBox;
var input = tb.Text.Trim();
if (input == "") tb.Text = DateTime.Now.ToShortDateString();
else
{
string dt = string.Empty;
if (!util.MakeDateString(input, out dt))
{
FCOMMON.Util.MsgE("입력값이 올바르지 않습니다.");
tb.SelectAll();
tb.Focus();
return;
}
else
{
tb.Text = dt;
}
}
if(tb == dtSD)
{
dtED.Focus();
dtED.SelectAll();
}
else
{
btSearch.PerformClick();
tb.SelectAll();
}
}
void __Closed(object sender, FormClosedEventArgs e)
{
@@ -44,7 +79,8 @@ namespace FEQ0000
private void __Load(object sender, EventArgs e)
{
this.tbRequest.Text = FCOMMON.info.Login.nameK;
this.cmDate.SelectedIndex = 0;
this.tbRequest.Text = string.Empty; //양진원 FCOMMON.info.Login.nameK;
this.dtSD.Text = DateTime.Now.AddDays(-30).ToShortDateString();
this.dtED.Text = DateTime.Now.AddDays(10).ToShortDateString();
@@ -55,7 +91,7 @@ namespace FEQ0000
cmbState.Items.Add("-- incomplete --");
foreach (var item in stList)
cmbState.Items.Add(item);
this.cmbState.SelectedIndex = 1;
this.cmbState.SelectedIndex = 0; //all기본 - 양진원
//일반사용자의경우에는 상태를 변경하지 못한다.
int curLevel = Math.Max(FCOMMON.info.Login.level, FCOMMON.DBM.getAuth_Purchase());
@@ -85,12 +121,15 @@ namespace FEQ0000
if (cmbState.SelectedIndex > 1) state = cmbState.Text.Split(',')[0].Substring(1);
string request = "%";
if (tbRequest.Text.Trim() != "") request = "%" + this.tbRequest.Text.Trim() + "%";
string dateField = "pdate";
if (cmDate.SelectedIndex == 1) dateField = "indate";
else if (cmDate.SelectedIndex == 2) dateField = "expdate";
System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter();
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
cmd.CommandText = " select *, dbo.getCodeName('04', state) AS stateName" +
" from purchase " +
" where pdate between @sd and @ed " +
" where isnull(" + dateField + ",'') between @sd and @ed " +
" and (isnull(request,'') like @req or isnull(receive,'') like @req)";
if (cmbState.SelectedIndex != 1) cmd.CommandText += " and state like @st";
@@ -334,7 +373,9 @@ namespace FEQ0000
}
else
{
string filter = "sid like ? or process like ? or sc like ? or pumname like ? or pumscale like ? or project like ?";
search = search.Replace("'", "''");
// search = search.Replace("*", "");
string filter = "supply like ? or sid like ? or process like ? or sc like ? or pumname like ? or pumscale like ? or project like ?";
filter = filter.Replace("?", "'%" + search + "%'");
this.bs.Filter = filter;
tbFind.BackColor = Color.Lime;
@@ -481,5 +522,20 @@ namespace FEQ0000
}
}
private void exportDataToolStripMenuItem_Click(object sender, EventArgs e)
{
SaveFileDialog sd = new SaveFileDialog();
sd.Filter = "excel|*.xls";
sd.FileName = "nrplist.xls";
if (sd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
fpSpread1.SaveExcel(sd.FileName,
FarPoint.Excel.ExcelSaveFlags.SaveAsViewed
| FarPoint.Excel.ExcelSaveFlags.NoFormulas
| FarPoint.Excel.ExcelSaveFlags.SaveCustomColumnHeaders);
}
}
}
}

View File

@@ -36,6 +36,10 @@
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.button3 = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.label6 = new System.Windows.Forms.Label();
this.ed = new System.Windows.Forms.DateTimePicker();
this.sd = new System.Windows.Forms.DateTimePicker();
this.label4 = new System.Windows.Forms.Label();
this.nudCE = new System.Windows.Forms.NumericUpDown();
this.nudCS = new System.Windows.Forms.NumericUpDown();
@@ -60,12 +64,10 @@
this.bindingNavigatorSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.progressBar1 = new System.Windows.Forms.ToolStripProgressBar();
this.bs = new System.Windows.Forms.BindingSource(this.components);
this.sd = new System.Windows.Forms.DateTimePicker();
this.ed = new System.Windows.Forms.DateTimePicker();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.label6 = new System.Windows.Forms.Label();
this.checkBox1 = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudCE)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudCS)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudE)).BeginInit();
@@ -74,7 +76,6 @@
((System.ComponentModel.ISupportInitialize)(this.bn)).BeginInit();
this.bn.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.bs)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
this.SuspendLayout();
//
// textBox1
@@ -128,6 +129,7 @@
//
// panel1
//
this.panel1.Controls.Add(this.checkBox1);
this.panel1.Controls.Add(this.numericUpDown2);
this.panel1.Controls.Add(this.label6);
this.panel1.Controls.Add(this.ed);
@@ -153,6 +155,47 @@
this.panel1.TabIndex = 0;
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
//
// numericUpDown2
//
this.numericUpDown2.Location = new System.Drawing.Point(406, 63);
this.numericUpDown2.Maximum = new decimal(new int[] {
65535,
0,
0,
0});
this.numericUpDown2.Name = "numericUpDown2";
this.numericUpDown2.Size = new System.Drawing.Size(45, 21);
this.numericUpDown2.TabIndex = 18;
this.numericUpDown2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.numericUpDown2.Value = new decimal(new int[] {
6,
0,
0,
0});
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(312, 67);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(87, 12);
this.label6.TabIndex = 17;
this.label6.Text = "Column Name";
//
// ed
//
this.ed.Location = new System.Drawing.Point(42, 67);
this.ed.Name = "ed";
this.ed.Size = new System.Drawing.Size(170, 21);
this.ed.TabIndex = 16;
//
// sd
//
this.sd.Location = new System.Drawing.Point(42, 40);
this.sd.Name = "sd";
this.sd.Size = new System.Drawing.Size(170, 21);
this.sd.TabIndex = 15;
//
// label4
//
this.label4.AutoSize = true;
@@ -404,46 +447,15 @@
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(200, 22);
//
// sd
// checkBox1
//
this.sd.Location = new System.Drawing.Point(42, 40);
this.sd.Name = "sd";
this.sd.Size = new System.Drawing.Size(170, 21);
this.sd.TabIndex = 15;
//
// ed
//
this.ed.Location = new System.Drawing.Point(42, 67);
this.ed.Name = "ed";
this.ed.Size = new System.Drawing.Size(170, 21);
this.ed.TabIndex = 16;
//
// numericUpDown2
//
this.numericUpDown2.Location = new System.Drawing.Point(406, 63);
this.numericUpDown2.Maximum = new decimal(new int[] {
65535,
0,
0,
0});
this.numericUpDown2.Name = "numericUpDown2";
this.numericUpDown2.Size = new System.Drawing.Size(45, 21);
this.numericUpDown2.TabIndex = 18;
this.numericUpDown2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.numericUpDown2.Value = new decimal(new int[] {
6,
0,
0,
0});
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(312, 67);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(87, 12);
this.label6.TabIndex = 17;
this.label6.Text = "Column Name";
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(474, 66);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(127, 16);
this.checkBox1.TabIndex = 19;
this.checkBox1.Text = "Auto Delete Import";
this.checkBox1.UseVisualStyleBackColor = true;
//
// fPurchase_Import
//
@@ -459,6 +471,7 @@
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudCE)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudCS)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudE)).EndInit();
@@ -468,7 +481,6 @@
this.bn.ResumeLayout(false);
this.bn.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.bs)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -510,5 +522,6 @@
private System.Windows.Forms.DateTimePicker sd;
private System.Windows.Forms.NumericUpDown numericUpDown2;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.CheckBox checkBox1;
}
}

View File

@@ -284,7 +284,7 @@ namespace FEQ0000
}
var taE = new dsPurchaseTableAdapters.PurchaseTableAdapter();
taE.DeleteImport();
if(checkBox1.Checked) taE.DeleteImport(sd.Value.ToShortDateString(),ed.Value.ToShortDateString());
taE.Update((dsPurchase.PurchaseDataTable)dt);
dt.AcceptChanges();