...
This commit is contained in:
		
							
								
								
									
										169
									
								
								SubProject/FEQ0000/Purchase/fPurchaseNR_Ipgo.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										169
									
								
								SubProject/FEQ0000/Purchase/fPurchaseNR_Ipgo.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,169 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.ComponentModel; | ||||
| using System.Data; | ||||
| using System.Drawing; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| using System.Windows.Forms; | ||||
|  | ||||
| namespace FEQ0000.Purchase | ||||
| { | ||||
|     public partial class fPurchaseNR_Ipgo : Form | ||||
|     { | ||||
|         int idx = -1; | ||||
|         public fPurchaseNR_Ipgo(int purchaseIdx) | ||||
|         { | ||||
|             InitializeComponent(); | ||||
|             this.idx = purchaseIdx; | ||||
|             this.KeyPreview = true; | ||||
|             this.KeyDown += (s1, e1) => { | ||||
|                 if (e1.KeyCode == Keys.Escape) this.Close(); | ||||
|             }; | ||||
|         } | ||||
|  | ||||
|         string prestatus = "PO"; | ||||
|         private void fPurchaseCR_Ipgo_Load(object sender, EventArgs e) | ||||
|         { | ||||
|             //담당자목록 | ||||
|             var ta = new dsPurchaseTableAdapters.PurchaseTableAdapter(); | ||||
|             var dt = ta.GetByIdx(this.idx); | ||||
|             if (dt == null || dt.Any() == false) | ||||
|             { | ||||
|                 FCOMMON.Util.MsgE("정보를 확인할 수 없습니다"); | ||||
|                 this.btOK.Enabled = false; | ||||
|                 return; | ||||
|             } | ||||
|             var dr = dt.First(); | ||||
|             prestatus = dr.state; | ||||
|  | ||||
|             textBox15.Text = dr.pumname; | ||||
|             textBox16.Text = dr.pumidx.ToString(); | ||||
|             textBox13.Text = dr.pumscale; | ||||
|             textBox11.Text = dr.pumunit; | ||||
|             textBox3.Text = dr.pumqty.ToString(); | ||||
|             textBox8.Text = dr.pumprice.ToString(); | ||||
|             textBox9.Text = (dr.pumqty * dr.pumprice).ToString(); | ||||
|             textBox10.Text = dr.bigo; | ||||
|  | ||||
|             //프로젝트정보 찾는다 | ||||
|             var tap = new DSPrjTableAdapters.ProjectsTableAdapter(); | ||||
|             var dtp = tap.GetData(dr.projectidx); | ||||
|             DSPrj.ProjectsRow drp; | ||||
|             if (dtp == null || dtp.Any() == false) | ||||
|             { | ||||
|                 drp = dtp.NewProjectsRow(); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 //프로젝트정보표시 | ||||
|                 drp = dtp.First(); | ||||
|             } | ||||
|             tbPrjName.Text = drp.name; | ||||
|             tbPrjAsset.Text = drp.asset; | ||||
|             tbPrjStatus.Text = drp.status; | ||||
|             tbPrjMemo.Text = drp.memo; | ||||
|             tbProjOrderNo.Text = drp.orderno; | ||||
|             tbPrjModel.Text = drp.model; | ||||
|             tbPrjSerial.Text = drp.serial; | ||||
|             tbPrjProcess.Text = drp.process; | ||||
|             tbPrjIdx.Text = drp.idx.ToString(); | ||||
|  | ||||
|  | ||||
|             var userList = FCOMMON.DBM.getUserList(); //.getGroupList("name", "Users", "[level] > 0 and [level] < 10"); | ||||
|             foreach (var user in userList) | ||||
|             { | ||||
|                 this.cmbReceive.Items.Add(string.Format("[{0}] {1}", user.Key, user.Value)); | ||||
|                 // this.cmbRequest.Items.Add(string.Format("[{0}] {1}", user.Key, user.Value)); | ||||
|             } | ||||
|  | ||||
|  | ||||
|             //기존에 설정된 정보가 있다면 그것을 쓴다 | ||||
|             if (dr.receive.isEmpty() == false) | ||||
|             { | ||||
|                 cmbReceive.Text = $"[{dr.receive}] {dr.receiveName}"; | ||||
|                 if (DateTime.TryParse(dr.indate, out DateTime dtin)) | ||||
|                 { | ||||
|                     dtInDate.Value = dtin; | ||||
|                 } | ||||
|                 else dtInDate.Value = DateTime.Now; | ||||
|                 chkInDate.Checked = true; | ||||
|                 tbInQty.Text = dr.inqty.ToString(); | ||||
|                 tbInRemar.Text = dr.inremark; | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 //설정정보가 없다면 비활성화해준다 | ||||
|                 cmbReceive.Text = FCOMMON.DBM.GetcurrentUserNoName(); | ||||
|                 dtInDate.Value = DateTime.Now; | ||||
|                 chkInDate.Checked = false; | ||||
|                 chkInDate_CheckedChanged(null, null); | ||||
|             } | ||||
|  | ||||
|  | ||||
|         } | ||||
|  | ||||
|         private void btOK_Click(object sender, EventArgs e) | ||||
|         { | ||||
|             if (chkInDate.Checked && cmbReceive.SelectedIndex < 0) | ||||
|             { | ||||
|                 FCOMMON.Util.MsgE("수령인을 선택하세요"); | ||||
|                 cmbReceive.Focus(); | ||||
|                 return; | ||||
|             } | ||||
|             var ta = new dsPurchaseTableAdapters.PurchaseTableAdapter (); | ||||
|             var dr = ta.GetByIdx(this.idx).First(); | ||||
|             if (chkInDate.Checked == false) | ||||
|             { | ||||
|                 dr.indate = string.Empty; | ||||
|                 dr.receive = string.Empty; | ||||
|                 //  dr.receiveName = string.Empty; | ||||
|                 dr.inqty = 0; | ||||
|                 dr.inremark = string.Empty; | ||||
|                 if (prestatus == "Received") dr.state = "---"; | ||||
|                 else dr.state = prestatus; | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 dr.indate = dtInDate.Value.ToShortDateString(); | ||||
|                 dr.receive = cmbReceive.Text.Substring(1, cmbReceive.Text.IndexOf("]") - 1); | ||||
|                 // dr.receiveName = cmbReceive.Text.Substring(cmbReceive.Text.IndexOf("]") + 1).Trim();                 | ||||
|                 if (int.TryParse(tbInQty.Text, out int qty) == false) | ||||
|                 { | ||||
|                     FCOMMON.Util.MsgE("수량을 확인하세요"); | ||||
|                     tbInQty.Focus(); | ||||
|                     tbInQty.SelectAll(); | ||||
|                     return; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if (qty > int.Parse(textBox3.Text)) | ||||
|                     { | ||||
|                         if (FCOMMON.Util.MsgQ("입고수량이 주문수량보다 많습니다 입력 할까요?") != DialogResult.Yes) | ||||
|                             return; | ||||
|                     } | ||||
|                     dr.inqty = qty; | ||||
|                 } | ||||
|                 dr.state = "Received"; | ||||
|                 dr.inremark = tbInRemar.Text.Trim(); | ||||
|             } | ||||
|  | ||||
|             dr.EndEdit(); | ||||
|             var cnt = ta.Update(dr); | ||||
|             DialogResult = DialogResult.OK; | ||||
|         } | ||||
|  | ||||
|         private void chkInDate_CheckedChanged(object sender, EventArgs e) | ||||
|         { | ||||
|             dtInDate.Enabled = chkInDate.Checked; | ||||
|             cmbReceive.Enabled = chkInDate.Checked; | ||||
|             tbInQty.Enabled = chkInDate.Checked; | ||||
|             tbInRemar.Enabled = chkInDate.Checked; | ||||
|             if (chkInDate.Checked == false) | ||||
|                 cmbReceive.SelectedIndex = -1; | ||||
|             else cmbReceive.Text = FCOMMON.DBM.GetcurrentUserNoName(); | ||||
|  | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 chi
					chi