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();

View File

@@ -2135,8 +2135,10 @@ ORDER BY pdate DESC, idx DESC";
this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[1].Connection = this.Connection;
this._commandCollection[1].CommandText = "DELETE FROM [Purchase] WHERE import = 1";
this._commandCollection[1].CommandText = "DELETE FROM Purchase\r\nWHERE (import = 1) AND (pdate BETWEEN @sd AND @ed)";
this._commandCollection[1].CommandType = global::System.Data.CommandType.Text;
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@sd", global::System.Data.SqlDbType.VarChar, 10, global::System.Data.ParameterDirection.Input, 0, 0, "pdate", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@ed", global::System.Data.SqlDbType.VarChar, 10, global::System.Data.ParameterDirection.Input, 0, 0, "pdate", global::System.Data.DataRowVersion.Original, false, null, "", "", ""));
this._commandCollection[2] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[2].Connection = this.Connection;
this._commandCollection[2].CommandText = @"SELECT idx, pdate, state, process, receive, sc, request, sid, pumname, pumscale, pumunit, pumqty, pumprice, pumamt, supply, supplyidx, project, projectidx, asset, edate, indate, po, dept, wuid,
@@ -3149,9 +3151,20 @@ ORDER BY pdate DESC, idx DESC";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, false)]
public virtual int DeleteImport() {
public virtual int DeleteImport(string sd, string ed) {
global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[1];
if ((sd == null)) {
command.Parameters[0].Value = global::System.DBNull.Value;
}
else {
command.Parameters[0].Value = ((string)(sd));
}
if ((ed == null)) {
command.Parameters[1].Value = global::System.DBNull.Value;
}
else {
command.Parameters[1].Value = ((string)(ed));
}
global::System.Data.ConnectionState previousConnectionState = command.Connection.State;
if (((command.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {

View File

@@ -222,13 +222,23 @@ SELECT idx, pdate, state, process, receive, sc, request, sid, pumname, pumscale,
<Mapping SourceColumn="stateName" DataSetColumn="stateName" />
</Mappings>
<Sources>
<DbSource ConnectionRef="gwcs (Settings)" DbObjectName="" DbObjectType="Unknown" GenerateShortCommands="true" GeneratorSourceName="DeleteImport" Modifier="Public" Name="DeleteImport" QueryType="NoData" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataBy" UserSourceName="DeleteImport">
<DbSource ConnectionRef="gwcs (Settings)" DbObjectType="Unknown" GenerateShortCommands="true" GeneratorSourceName="DeleteImport" Modifier="Public" Name="DeleteImport" QueryType="NoData" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataBy" UserSourceName="DeleteImport">
<DeleteCommand>
<DbCommand CommandType="Text" ModifiedByUser="true">
<CommandText>DELETE FROM [Purchase] WHERE import = 1</CommandText>
<Parameters />
</DbCommand>
</DeleteCommand>
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="true">
<CommandText>DELETE FROM Purchase
WHERE (import = 1) AND (pdate BETWEEN @sd AND @ed)</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="sd" ColumnName="pdate" DataSourceName="GroupWare.dbo.Purchase" DataTypeServer="varchar(10)" DbType="AnsiString" Direction="Input" ParameterName="@sd" Precision="0" ProviderType="VarChar" Scale="0" Size="10" SourceColumn="pdate" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="ed" ColumnName="pdate" DataSourceName="GroupWare.dbo.Purchase" DataTypeServer="varchar(10)" DbType="AnsiString" Direction="Input" ParameterName="@ed" Precision="0" ProviderType="VarChar" Scale="0" Size="10" SourceColumn="pdate" SourceColumnNullMapping="false" SourceVersion="Original" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
<DbSource ConnectionRef="gwcs (Settings)" DbObjectName="GroupWare.dbo.Purchase" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="FillDate" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetDate" GeneratorSourceName="FillDate" GetMethodModifier="Public" GetMethodName="GetDate" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDate" UserSourceName="FillDate">
<SelectCommand>
@@ -255,7 +265,7 @@ ORDER BY pdate DESC, idx DESC</CommandText>
<xs:element name="dsPurchase" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="dsPurchase" msprop:Generator_UserDSName="dsPurchase">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Purchase" msprop:Generator_TableClassName="PurchaseDataTable" msprop:Generator_TableVarName="tablePurchase" msprop:Generator_TablePropName="Purchase" msprop:Generator_RowDeletingName="PurchaseRowDeleting" msprop:Generator_RowChangingName="PurchaseRowChanging" msprop:Generator_RowEvHandlerName="PurchaseRowChangeEventHandler" msprop:Generator_RowDeletedName="PurchaseRowDeleted" msprop:Generator_UserTableName="Purchase" msprop:Generator_RowChangedName="PurchaseRowChanged" msprop:Generator_RowEvArgName="PurchaseRowChangeEvent" msprop:Generator_RowClassName="PurchaseRow">
<xs:element name="Purchase" msprop:Generator_TableClassName="PurchaseDataTable" msprop:Generator_TableVarName="tablePurchase" msprop:Generator_RowChangedName="PurchaseRowChanged" msprop:Generator_TablePropName="Purchase" msprop:Generator_RowDeletingName="PurchaseRowDeleting" msprop:Generator_RowChangingName="PurchaseRowChanging" msprop:Generator_RowEvHandlerName="PurchaseRowChangeEventHandler" msprop:Generator_RowDeletedName="PurchaseRowDeleted" msprop:Generator_RowClassName="PurchaseRow" msprop:Generator_UserTableName="Purchase" msprop:Generator_RowEvArgName="PurchaseRowChangeEvent">
<xs:complexType>
<xs:sequence>
<xs:element name="idx" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnVarNameInTable="columnidx" msprop:Generator_ColumnPropNameInRow="idx" msprop:Generator_ColumnPropNameInTable="idxColumn" msprop:Generator_UserColumnName="idx" type="xs:int" />