private void cboStores_SelectedValueChanged(object sender, EventArgs e) { if (cboStores.EditValue != null) { ReceiveDoc rec = new ReceiveDoc(); DataTable dtRec = new DataTable(); dtRec = rec.GetDistinctRecDocments(Convert.ToInt32(cboStores.EditValue)); PopulateDocuments(dtRec); DateTime dt1 = new DateTime(); DateTime dt2 = new DateTime(); dtDate.Value = DateTimeHelper.ServerDateTime; DateTime dtCurrent = ConvertDate.DateConverter(dtDate.Text); int yr = ((dtCurrent.Month > 10) ? dtCurrent.Year : dtCurrent.Year - 1); dt1 = new DateTime(yr, 11, 1); dt2 = new DateTime(dtCurrent.Year, dtCurrent.Month, dtCurrent.Day); dtRec = rec.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2); PopulateTransactions(dtRec); } }
private void btnDeleteWithRfNo_Click(object sender, EventArgs e) { CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx { CustomFormat = "MM/dd/yyyy", Value = DateTime.Now }; DateTime dtCurrent = ConvertDate.DateConverter(dtDate.Text); DataRowView dr = (DataRowView) lstTree.GetDataRecordByNode(lstTree.FocusedNode); if (dr == null) return; ReceiveDoc rec = new ReceiveDoc(); DataTable dtRec; if (dr["ParentID"] == DBNull.Value) { int yr = ((dtCurrent.Month > 10) ? dtCurrent.Year : dtCurrent.Year - 1); DateTime dt1 = new DateTime(Convert.ToInt32(dr["ID"]) - 1, 11, 1); DateTime dt2 = new DateTime(Convert.ToInt32(dr["ID"]), 11, 1); dtRec = rec.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2); string dateString = dr["RefNo"].ToString(); lblRecDate.Text = dateString; } else { dtRec = rec.GetTransactionByRefNo(dr["RefNo"].ToString(), Convert.ToInt32(cboStores.EditValue), dr["Date"].ToString()); lblRecDate.Text = Convert.ToDateTime(dr["Date"]).ToString("MM dd,yyyy"); } foreach (DataRow recieve in dtRec.Rows) { AddDeletedRecieveDocs(recieve); } }
private void toolStripMenuItem2_Click(object sender, EventArgs e) { var us = new User(); var userID = MainWindow.LoggedinId; us.LoadByPrimaryKey(userID); var dr = gridView1.GetFocusedDataRow(); if (dr == null) return; int tranId = Convert.ToInt32(dr["ID"]); var rec = new ReceiveDoc(); rec.LoadByPrimaryKey(tranId); var iss = new IssueDoc(); iss.GetIssueByBatchAndId(rec.ItemID, rec.BatchNo, rec.ID); _dtDate.CustomFormat = "MM/dd/yyyy"; DateTime dtCurrent = ConvertDate.DateConverter(_dtDate.Text); if ((rec.Date.Year != dtCurrent.Year && rec.Date.Month < 11) || (iss.RowCount != 0)) { XtraMessageBox.Show("Unable to Delete, This Transaction has been processed. Try Loss and Adjustment.", "Unable to Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); } else { 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) { //AddDeletedRecieveDoc(rec); rec.MarkAsDeleted(); rec.Save(); _dtDate.Value = DateTime.Now; _dtDate.CustomFormat = "MM/dd/yyyy"; dtCurrent = ConvertDate.DateConverter(_dtDate.Text); int yr = ((dtCurrent.Month > 10) ? dtCurrent.Year : dtCurrent.Year - 1); DateTime dt1 = new DateTime(yr, 11, 1); DateTime dt2 = new DateTime(dtCurrent.Year, dtCurrent.Month, dtCurrent.Day); DataTable dtRec = rec.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2); gridReceives.DataSource = dtRec; } } }
private void ManageItems_Load(object sender, EventArgs e) { var stor = new Stores(); stor.GetActiveStores(); cboStores.Properties.DataSource = stor.DefaultView; cboStores.ItemIndex = 0; var sup = new Supplier(); var dtSup = sup.GetSuppliersWithTransaction(); cboSupplier.Properties.DataSource = dtSup; cboSupplier.ItemIndex = -1; cboSupplier.Text = "Select Supplier"; var itemunit = new ItemUnit(); var units = itemunit.GetAllUnits(); unitsbindingSource.DataSource = units.DefaultView; // bind the supplier lookup for the grid. lkEditSupplier.DataSource = dtSup; var unitcolumn = ((GridView)gridReceives.MainView).Columns[14]; switch (VisibilitySetting.HandleUnits) { case 1: unitcolumn.Visible = false; break; case 2: unitcolumn.Visible = true; break; default: unitcolumn.Visible = true; break; } // bind the current dates try { var dr = (DataRowView) lstTree.GetDataRecordByNode(lstTree.Nodes[0].FirstNode); if (dr == null) return; var rec = new ReceiveDoc(); if (dr["ParentID"] == DBNull.Value) { // int yr = ((dtCurrent.Month > 10) ? dtCurrent.Year : dtCurrent.Year - 1); var dt1 = new DateTime(Convert.ToInt32(dr["ID"]) - 1, 11, 1); var dt2 = new DateTime(Convert.ToInt32(dr["ID"]), 11, 1); dtRec = rec.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2); lblRecDate.Text = dr["RefNo"].ToString(); } else { dtRec = rec.GetTransactionByRefNo(dr["RefNo"].ToString(), Convert.ToInt32(cboStores.EditValue),dr["Date"].ToString()); lblRecDate.Text = Convert.ToDateTime(dr["Date"]).ToString("MM dd,yyyy"); } gridReceives.DataSource = dtRec; } catch (Exception ex) { } }
private void lstTree_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { var dtDate = new CalendarLib.DateTimePickerEx { CustomFormat = "MM/dd/yyyy", Value = DateTime.Now }; DateTime dtCurrent = ConvertDate.DateConverter(dtDate.Text); var dr = (DataRowView) lstTree.GetDataRecordByNode(lstTree.FocusedNode); if (dr == null) return; var rec = new ReceiveDoc(); DataTable dtRec; if (dr["ParentID"] == DBNull.Value) { int yr = ((dtCurrent.Month > 10) ? dtCurrent.Year : dtCurrent.Year - 1); DateTime dt1 = new DateTime(Convert.ToInt32(dr["ID"]) - 1, 11, 1); DateTime dt2 = new DateTime(Convert.ToInt32(dr["ID"]), 11, 1); dtRec = rec.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2); lblRecDate.Text = dr["RefNo"].ToString(); } else { dtRec = rec.GetTransactionByRefNo(dr["RefNo"].ToString(), Convert.ToInt32(cboStores.EditValue),dr["Date"].ToString()); lblRecDate.Text = Convert.ToDateTime(dr["Date"]).ToString("MM dd,yyyy"); } gridReceives.DataSource = dtRec; }
private void dtTo_ValueChanged(object sender, EventArgs e) { ReceiveDoc rec = new ReceiveDoc(); dtFrom.CustomFormat = "MM/dd/yyyy"; dtTo.CustomFormat = "MM/dd/yyyy"; DateTime dteFrom = ConvertDate.DateConverter(dtFrom.Text); DateTime dteTo = ConvertDate.DateConverter(dtTo.Text); DataTable dtRec = dteFrom < dteTo ? rec.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dteFrom, dteTo) : rec.GetAllTransaction(Convert.ToInt32(cboStores.EditValue)); gridReceives.DataSource = dtRec; dtFrom.CustomFormat = "MMMM dd, yyyy"; dtTo.CustomFormat = "MMMM dd, yyyy"; }
private void gridViewRefNo_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { DataRow dr = gridViewRefNo.GetFocusedDataRow(); DateTime dt1 = new DateTime(); DateTime dt2 = new DateTime(); dtDate.Value = DateTimeHelper.ServerDateTime; DateTime dtCurrent = ConvertDate.DateConverter(dtDate.Text); if (dr == null) return; lblMode.Text = dr["Mode"] == DBNull.Value ? "-" : Convert.ToString(dr["Mode"]); lblAccount.Text = dr["Account"] == DBNull.Value ? "-" : Convert.ToString(dr["Account"]); lblSubAccount.Text = dr["SubAccount"] == DBNull.Value ? "-" : Convert.ToString(dr["SubAccount"]); lblActivity.Text = dr["Activity"] == DBNull.Value ? "-" : Convert.ToString(dr["Activity"]); lblSupplier.Text = dr["Supplier"] == DBNull.Value ? "-" : Convert.ToString(dr["Supplier"]); lblInvoiceNo.Text = dr["STVOrInvoiceNo"] == DBNull.Value ? "-" : Convert.ToString(dr["STVOrInvoiceNo"]); lblPaymentType.Text = dr["PaymentType"] == DBNull.Value ? "-" : Convert.ToString(dr["PaymentType"]); lblPONumber.Text = dr["PONumber"] == DBNull.Value ? "-" : Convert.ToString(dr["PONumber"]); lblPOType.Text = dr["POType"] == DBNull.Value ? "-" : Convert.ToString(dr["POType"]); lblDocumentType.Text = dr["DocumentType"] == DBNull.Value ? "-" : Convert.ToString(dr["DocumentType"]); lblCluster.Text = dr["Cluster"] == DBNull.Value ? "-" : Convert.ToString(dr["Cluster"]); lblWarehouse.Text = dr["Warehouse"] == DBNull.Value ? "-" : Convert.ToString(dr["Warehouse"]); lblPhysicalStore.Text = dr["PhysicalStore"] == DBNull.Value ? "-" : Convert.ToString(dr["PhysicalStore"]); lblReceiveType.Text = dr["ReceiptType"] == DBNull.Value ? "-" : Convert.ToString(dr["ReceiptType"]); lblReceiveStatus.Text = dr["ReceiptStatus"] == DBNull.Value ? "-" : Convert.ToString(dr["ReceiptStatus"]); lblReceivedDate.Text = dr["ReceivedDate"] == DBNull.Value ? "-" : Convert.ToDateTime(dr["ReceivedDate"]).ToShortDateString(); lblReceivedBy.Text = dr["ReceivedBy"] == DBNull.Value ? "-" : Convert.ToString(dr["ReceivedBy"]); var receiptConfirmationPrintout = new ReceiptConfirmationPrintout(); var grnfDetail = receiptConfirmationPrintout.GetReceivePrintoutDetail(Convert.ToInt32(dr["ReceiptID"]),"PGRV"); var grvDetail = receiptConfirmationPrintout.GetReceivePrintoutDetail(Convert.ToInt32(dr["ReceiptID"]), "GRV"); if (grnfDetail != null) { lblGRNFNo.Text = grnfDetail["IDPrinted"] == DBNull.Value ? "-" : Convert.ToString(grnfDetail["IDPrinted"]); lblGRNFDate.Text = grnfDetail["PrintedDate"] == DBNull.Value ? "-" : Convert.ToDateTime(grnfDetail["PrintedDate"]).ToShortDateString(); lblGRNFBy.Text = grnfDetail["FullName"] == DBNull.Value ? "-" : Convert.ToString(grnfDetail["FullName"]); } if (grvDetail != null) { lblGRVDate.Text = grvDetail["PrintedDate"] == DBNull.Value ? "-" : Convert.ToDateTime(grvDetail["PrintedDate"]).ToShortDateString(); lblGRVBy.Text = grvDetail["FullName"] == DBNull.Value ? "-" : Convert.ToString(grvDetail["FullName"]); } string ReferenceNo = dr["RefNo"].ToString(); if (ReferenceNo != "") { gridTransactions.DataSource = null; ReceiveDoc rec = new ReceiveDoc(); DataTable dtRec = new DataTable(); if (ReferenceNo == "0") { int yr = ((dtCurrent.Month > 10) ? dtCurrent.Year : dtCurrent.Year - 1); dt1 = new DateTime(yr, 11, 1); dt2 = new DateTime(dtCurrent.Year, dtCurrent.Month, dtCurrent.Day); dtRec = rec.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2); //lblRecDate.Text = "Current Year";// ( " + dtCurrent.Year + " )"; } else if (ReferenceNo == "1") { int yr = ((dtCurrent.Month > 10) ? dtCurrent.Year : dtCurrent.Year - 1); dt1 = new DateTime(1980, 11, 1); dt2 = new DateTime(yr, 10, 30); dtRec = rec.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2); //lblRecDate.Text = "Past Year(s)"; } else { dtRec = rec.GetTransactionByRefNo(ReferenceNo, Convert.ToInt32(cboStores.EditValue), dr["Date"].ToString()); //lblRecDate.Text = Convert.ToDateTime(ReferenceNo[1]).ToString("MM dd,yyyy"); } PopulateTransactions(dtRec); } }
private void dtTo_ValueChanged(object sender, EventArgs e) { if (_isReady) { ReceiveDoc rec = new ReceiveDoc(); dtFrom.CustomFormat = "MM/dd/yyyy"; dtTo.CustomFormat = "MM/dd/yyyy"; DateTime dteFrom = new DateTime(); DateTime dteTo = new DateTime(); dteFrom = ConvertDate.DateConverter(dtFrom.Text); dteTo = ConvertDate.DateConverter(dtTo.Text); DataTable dtRec = new DataTable(); if (dteFrom < dteTo) { dtRec = rec.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dteFrom, dteTo); } else { dtRec = rec.GetAllTransaction(Convert.ToInt32(cboStores.EditValue)); } PopulateTransactions(dtRec); } }