private void toolStripMenuItem1_Click(object sender, EventArgs e) { DataRow dr = grdLogIssue.GetFocusedDataRow(); if (dr == null) { return; } int tranId = Convert.ToInt32(dr["ID"]); EditIssue edRec = new EditIssue(tranId); MainWindow.ShowForms(edRec); IssueDoc iss = new IssueDoc(); DataTable dtRec = iss.GetAllTransaction(Convert.ToInt32(cboStores.EditValue)); /*PopulateTransaction(dtRec);*/ gridIssues.DataSource = dtRec; }
private void toolStripMenuItem2_Click(object sender, EventArgs e) { var us = new User(); var userID = MainWindow.LoggedinId; us.LoadByPrimaryKey(userID); DataRow dr = grdLogIssue.GetFocusedDataRow(); if (dr == null) { return; } int tranId = Convert.ToInt32(dr["ID"]); var rec = new ReceiveDoc(); var iss = new IssueDoc(); iss.LoadByPrimaryKey(tranId); string batchNo = iss.BatchNo; try { if (iss.RecievDocID.ToString() != "") { rec.LoadByPrimaryKey(iss.RecievDocID); } else { rec.GetTransactionByBatch(iss.ItemID, iss.BatchNo, iss.StoreId); } } catch { rec.GetTransactionByBatch(iss.ItemID, iss.BatchNo, iss.StoreId); } if (batchNo != rec.BatchNo && batchNo != string.Empty) { XtraMessageBox.Show("Unable to Delete, This Transaction has been processed. Try Loss and Adjustment.", "Unable to Delete", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else if (batchNo == string.Empty || batchNo == rec.BatchNo) { if (XtraMessageBox.Show("Are You Sure, You want to delete this Transaction? You will not be able to restore this data.", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { rec.QuantityLeft = rec.QuantityLeft + iss.Quantity; if (rec.QuantityLeft > 0) { rec.Out = false; } rec.Save(); AddIssueLodDelete(iss); DeletedRelatedModel(iss); iss.MarkAsDeleted(); iss.Save(); DataTable dtRec = iss.GetAllTransaction(Convert.ToInt32(cboStores.EditValue)); gridIssues.DataSource = dtRec; } } }
private void dtTo_ValueChanged(object sender, EventArgs e) { //CALENDAR: IssueDoc iss = new IssueDoc(); //dtFrom.CustomFormat = "MM/dd/yyyy"; //dtTo.CustomFormat = "MM/dd/yyyy"; //DateTime dteFrom = ConvertDate.DateConverter(dtFrom.Text); //DateTime dteTo = ConvertDate.DateConverter(dtTo.Text); DataTable dtRec = dtFrom.Value < dtTo.Value ? iss.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dtFrom.Value, dtTo.Value) : iss.GetAllTransaction(Convert.ToInt32(cboStores.EditValue)); gridIssues.DataSource = dtRec; }