private void btnSubmit_Click(object sender, EventArgs e) { Button oBtn = sender as Button; if (oBtn != null && formloaded) { CutReportOptions cutOpts = new CutReportOptions(); cutOpts.C3SortOption = sortOptions; cutOpts.RepNo = _RepNo; if (_RepNo == 1) { frmCutViewRep vRep = new frmCutViewRep(7, cutOpts); int h = Screen.PrimaryScreen.WorkingArea.Height; int w = Screen.PrimaryScreen.WorkingArea.Width; vRep.ClientSize = new Size(w, h); vRep.ShowDialog(); } else { cutOpts.fromDate = Convert.ToDateTime(dtpFromDate.Value.ToShortDateString()); cutOpts.toDate = Convert.ToDateTime(dtpToDate.Value.ToShortDateString()); cutOpts.toDate = cutOpts.toDate.AddHours(23); frmCutViewRep vRep = new frmCutViewRep(8, cutOpts); int h = Screen.PrimaryScreen.WorkingArea.Height; int w = Screen.PrimaryScreen.WorkingArea.Width; vRep.ClientSize = new Size(w, h); vRep.ShowDialog(); } sortOptions = 1; } }
private void btnSubmit_Click(object sender, EventArgs e) { Button oBtn = sender as Button; if (oBtn != null && formloaded) { using (var context = new TTI2Entities()) { CutReportOptions repOptions = new CutReportOptions(); if (chkQAReport.Checked) { repOptions.QAReport = true; } repOptions.fromDate = Convert.ToDateTime(dtpFromDate.Value.ToShortDateString()); repOptions.toDate = Convert.ToDateTime(dtpToDate.Value.ToShortDateString()); repOptions.toDate = repOptions.toDate.AddHours(23); repOptions.C4SortOption = RepSortOption; frmCutViewRep vRep = new frmCutViewRep(5, repOptions); int h = Screen.PrimaryScreen.WorkingArea.Height; int w = Screen.PrimaryScreen.WorkingArea.Width; vRep.ClientSize = new Size(w, h); vRep.ShowDialog(this); repOptions = new CutReportOptions(); } } }
private void btnSubmit_Click(object sender, EventArgs e) { Button oBtn = (Button)sender; if (oBtn != null && formloaded) { CutReportOptions repOptions = new CutReportOptions(); parms.FromDate = Convert.ToDateTime(dtpFromDate.Value.ToShortDateString()); parms.ToDate = Convert.ToDateTime(dtpToDate.Value.ToShortDateString()); parms.ToDate = parms.ToDate.AddHours(23); frmCutViewRep vRep = new frmCutViewRep(15, repOptions, parms); int h = Screen.PrimaryScreen.WorkingArea.Height; int w = Screen.PrimaryScreen.WorkingArea.Width; vRep.ClientSize = new Size(w, h); vRep.ShowDialog(this); } }
private void btnSubmit_Click(object sender, EventArgs e) { Button oBtn = sender as Button; if (oBtn != null && formloaded) { CutReportOptions cutOpts = new CutReportOptions(); cutOpts.C2SortOption = sortOptions; frmCutViewRep vRep = new frmCutViewRep(6, cutOpts, parms); int h = Screen.PrimaryScreen.WorkingArea.Height; int w = Screen.PrimaryScreen.WorkingArea.Width; vRep.ClientSize = new Size(w, h); vRep.ShowDialog(); sortOptions = 1; cmboWareHouseStore.Items.Clear(); frmSelPanelStock_Load(this, null); } }
private void btnSave_Click(object sender, EventArgs e) { bool Update = false; Button oBtn = sender as Button; if (oBtn != null && formloaded) { var selected = (TLCUT_CutSheet)cmboCutSheet.SelectedItem; if (selected == null) { MessageBox.Show("Please select a cut sheet from the drop down list "); return; } var WhseSelected = (TLADM_WhseStore)cmboRejectStore.SelectedItem; if (WhseSelected == null) { MessageBox.Show("Please select a reject store from the drop down list"); return; } if (String.IsNullOrEmpty(txtAuthorisedBy.Text)) { MessageBox.Show("Please complete the approved by details"); return; } using (var context = new TTI2Entities()) { var CSR = context.TLCUT_CutSheetReceipt.Where(x => x.TLCUTSHR_CutSheet_FK == selected.TLCutSH_Pk).FirstOrDefault(); CutReportOptions cropts = new CutReportOptions(); cropts.remarks = rtbNotes.Text; cropts.TransDate = dtpTransDate.Value; cropts.ApprovedBy = txtAuthorisedBy.Text; cropts.Pk = CSR.TLCUTSHR_Pk; cropts.CutSheetPk = selected.TLCutSH_Pk; cropts.ReturnedTo = context.TLADM_WhseStore.Find(WhseSelected.WhStore_Id).WhStore_Description; var cs = context.TLCUT_CutSheet.Find(selected.TLCutSH_Pk); if (cs != null) { cs.TLCutSH_Notes = rtbNotes.Text; } foreach (DataGridViewRow row in dataGridView1.Rows) { if ((bool)row.Cells[1].Value == false) { continue; } //------------------------------------------------------ // 1st Step reduce the SOH with what was written off //----------------------------------------------------------- var index = (int)row.Cells[0].Value; var CSRD = context.TLCUT_CutSheetReceiptDetail.Find(index); if (CSRD != null) { CSRD.TLCUTSHRD_RejectQty += (int)row.Cells[6].Value; CSRD.TLCUTSHRD_RejectDate = dtpTransDate.Value; CSRD.TLCUTSHRD_RejectReason = (int)row.Cells[5].Value; } //------------------------------------------------- // Now create a new Record of the written off value //--------------------------------------------------- TLCUT_CutSheetReceiptDetail NewCSR = new TLCUT_CutSheetReceiptDetail(); NewCSR.TLCUTSHRD_CutSheet_FK = CSR.TLCUTSHR_Pk; NewCSR.TLCUTSHRD_Description = row.Cells[2].Value.ToString() + "R"; NewCSR.TLCUTSHRD_Size_FK = (int)row.Cells[3].Value; NewCSR.TLCUTSHRD_BundleQty = (int)row.Cells[4].Value; NewCSR.TLCUTSHRD_BoxUnits = 0; NewCSR.TLCUTSHRD_TransactionType = 55; NewCSR.TLCUTSHRD_CurrentStore_FK = WhseSelected.WhStore_Id; NewCSR.TLCUTSHRD_PanelRejected = true; NewCSR.TLCUTSHRD_RejectDate = dtpTransDate.Value; NewCSR.TLCUTSHRD_RejectQty = (int)row.Cells[6].Value; NewCSR.TLCUTSHRD_RejectReason = (int)row.Cells[5].Value; context.TLCUT_CutSheetReceiptDetail.Add(NewCSR); Update = true; } //------------------------------------------------------- // //----------------------------------------------------------- string Mach_IP = Dns.GetHostEntry(Dns.GetHostName()) .AddressList.First(f => f.AddressFamily == AddressFamily.InterNetwork) .ToString(); var Dept = context.TLADM_Departments.Where(x => x.Dep_ShortCode.Contains("CUT")).FirstOrDefault(); TLADM_DailyLog DailyLog = new TLADM_DailyLog(); DailyLog.TLDL_IPAddress = Mach_IP; DailyLog.TLDL_Dept_Fk = Dept.Dep_Id; DailyLog.TLDL_Date = DateTime.Now; DailyLog.TLDL_TransDetail = "Cutting Dept Panel Rejected"; DailyLog.TLDL_AuthorisedBy = txtAuthorisedBy.Text;; DailyLog.TLDL_Comments = rtbNotes.Text; context.TLADM_DailyLog.Add(DailyLog); //---------------------------------------------------------- if (Update) { try { context.SaveChanges(); MessageBox.Show("Data saved successfully to database"); frmCutViewRep vRep = new frmCutViewRep(3, cropts); int h = Screen.PrimaryScreen.WorkingArea.Height; int w = Screen.PrimaryScreen.WorkingArea.Width; vRep.ClientSize = new Size(w, h); vRep.ShowDialog(this); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } } }
private void btnSave_Click(object sender, EventArgs e) { Button oBtn = (Button)sender; int LastNumberUsed = 0; if (oBtn != null && FormLoaded) { CutReportOptions ops = new CutReportOptions(); using (var context = new TTI2Entities()) { var Dept = context.TLADM_Departments.Where(x => x.Dep_ShortCode == "CUT").FirstOrDefault(); if (Dept != null) { var LstNumberUsed = context.TLADM_LastNumberUsed.Where(x => x.LUN_Department_FK == Dept.Dep_Id).FirstOrDefault(); if (LstNumberUsed != null) { LastNumberUsed = LstNumberUsed.col4; LstNumberUsed.col4 += 1; } } foreach (DataGridViewRow Row in dataGridView2.Rows) { bool IsChecked = (bool)Row.Cells[1].Value; if (!IsChecked) { continue; } int Pk = (int)Row.Cells[0].Value; ops.BIFTransit.Add(Pk); var BIFInTrans = context.TLDYE_BIFInTransit.Find(Pk); if (BIFInTrans != null) { var BifDetails = context.TLDYE_BIFInTransitDetails.Where(x => x.BIFD_Intransit_FK == BIFInTrans.BIFT_Pk).ToList(); foreach (var Detail in BifDetails) { var DBDetail = context.TLDYE_DyeBatchDetails.Find(Detail.BIFD_DyeBatchDetail_FK); if (DBDetail != null) { DBDetail.DYEBO_CurrentStore_FK = BIFInTrans.BIFT_ToFabric_FK; } } BIFInTrans.BIFT_Delivery_Number = LastNumberUsed; BIFInTrans.BIFT_Despatched = true; BIFInTrans.BIFT_Despatched_Date = DateTime.Now; } } try { context.SaveChanges(); MessageBox.Show("Data successfully saved to database"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } Cutting.frmCutViewRep vRep = new Cutting.frmCutViewRep(17, ops); int h = Screen.PrimaryScreen.WorkingArea.Height; int w = Screen.PrimaryScreen.WorkingArea.Width; vRep.ClientSize = new Size(w, h); vRep.ShowDialog(); } }