private void RefreshReportDeposit(bool allDeposit) { if (!UserService.AllowToPerform(Resources.PermissionViewDepositReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } var searchCriteria = !allDeposit ? new List <string> { "(DepositDate BETWEEN CONVERT(DATETIME, '" + dtpStartDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + "', 103) AND CONVERT(DATETIME, '" + dtpStopDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + " 23:59', 103)) ", "(AmountPaidInt < AmountSoldInt) ", "DepositNumber NOT IN (SELECT ReferenceNum FROM TDeposits WHERE ReferenceNum IS NOT NULL) " } : new List <string> { "(DepositDate BETWEEN CONVERT(DATETIME, '" + dtpStartDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + "', 103) AND CONVERT(DATETIME, '" + dtpStopDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + " 23:59', 103)) " }; var assessmentList = _depositService.GetDepositHistories(searchCriteria, false); DataSet dtsModel = new DtsModels(); var propertyInfos = typeof(DepositReport).GetProperties(); foreach (var objInstance in assessmentList) { var dataRow = dtsModel.Tables[3].NewRow(); foreach (var propertyInfo in propertyInfos) { dataRow[propertyInfo.Name] = propertyInfo.GetValue(objInstance, null); } dtsModel.Tables[3].Rows.Add(dataRow); } var rptDeposit = new CsrDeposit(); rptDeposit.SetDataSource(dtsModel); crvReport.ReportSource = rptDeposit; }
private void RefreshReportReturn() { if (!UserService.AllowToPerform(Resources.PermissionViewReturnProductReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } var searchCriteria = new List <string> { "SaleOrderNumber IN (SELECT SaleOrderNumber FROM TSaleOrders WHERE SaleOrderTypeId = 1)", "SaleOrderDate BETWEEN CONVERT(DATETIME, '" + dtpStartDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + "', 103) AND CONVERT(DATETIME, '" + dtpStopDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + " 23:59', 103)" }; var assessmentList = _SaleOrderService.GetSaleHistories(searchCriteria); DataSet dtsModel = new DtsModels(); var propertyInfos = typeof(SaleOrderReport).GetProperties(); foreach (var objInstance in assessmentList) { var dataRow = dtsModel.Tables[1].NewRow(); foreach (var propertyInfo in propertyInfos) { dataRow[propertyInfo.Name] = propertyInfo.GetValue(objInstance, null); } dtsModel.Tables[1].Rows.Add(dataRow); } var rptSaleReturn = new CsrSaleReturn(); rptSaleReturn.SetDataSource(dtsModel); crvReport.ReportSource = rptSaleReturn; }
private void RefreshDailyExpenseReport() { if (!UserService.AllowToPerform(Resources.PermissionViewExpenseReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } var searchCriteria = new List <string> { "CONVERT(DATETIME, ExpenseDate, 103) BETWEEN CONVERT(DATETIME, '" + dtpStartDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + "', 103) AND CONVERT(DATETIME, '" + dtpStopDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + " 23:59', 103)" }; var expenseList = _ExpenseService.GetExpenses(searchCriteria); DataSet dtsProduct = new DtsModels(); var propertyInfos = typeof(Expense).GetProperties(); foreach (var objInstance in expenseList) { var dataRow = dtsProduct.Tables["DtbExpenses"].NewRow(); foreach (var propertyInfo in propertyInfos) { dataRow[propertyInfo.Name] = propertyInfo.GetValue(objInstance, null); } dtsProduct.Tables["DtbExpenses"].Rows.Add(dataRow); } var csrExpense = new CsrExpense(); csrExpense.SetDataSource(dtsProduct); crvReport.ReportSource = csrExpense; }
private void RefreshReportStock() { try { if (rdbStockDetail.Checked) { if (!UserService.AllowToPerform(Resources.PermissionViewDetailStockReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } } else if (rdbStockShort.Checked) { if (!UserService.AllowToPerform(Resources.PermissionViewStockReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } } else { if (!UserService.AllowToPerform(Resources.PermissionViewExpiredProductReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } } var searchCriteria = new List<string> {"QtyInStock > 0"}; if (rdbProductExpired.Checked) searchCriteria.Add( "LastUpdate <= CONVERT(DATETIME, '" + DateTime.Now.AddMonths(-1).ToString("dd/MM/yyyy") + "', 103)"); var productList = _ProductService.GetObjects(searchCriteria); DataSet dtsProduct = new DtsModels(); var propertyInfos = typeof (Product).GetProperties(); foreach (var objInstance in productList) { var dataRow = dtsProduct.Tables[0].NewRow(); foreach (var propertyInfo in propertyInfos) dataRow[propertyInfo.Name] = propertyInfo.GetValue(objInstance, null); dtsProduct.Tables[0].Rows.Add(dataRow); } if ((rdbStockDetail.Checked) || (rdbProductExpired.Checked)) { var csrCatalog = new CsrCatalog(); csrCatalog.SetDataSource(dtsProduct); crvReport.ReportSource = csrCatalog; } else { var csrCatalogShorten = new CsrCatalogShorten(); csrCatalogShorten.SetDataSource(dtsProduct); crvReport.ReportSource = csrCatalogShorten; } } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void RefreshReportSale() { if (chbShowBenefit.Checked) { if (!UserService.AllowToPerform(Resources.PermissionViewSaleDetailReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } } else { if (!UserService.AllowToPerform(Resources.PermissionViewSaleReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } } var searchCriteria = new List<string> { "SaleOrderNumber IN (SELECT SaleOrderNumber FROM TSaleOrders WHERE SaleOrderTypeId = 0)", "SaleOrderDate BETWEEN CONVERT(DATETIME, '" + dtpStartDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + "', 103) AND CONVERT(DATETIME, '" + dtpStopDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + " 23:59', 103)" }; var saleList = _SaleOrderService.GetSaleHistories(searchCriteria); DataSet dtsModel = new DtsModels(); var propertyInfos = typeof (SaleOrderReport).GetProperties(); foreach (var objInstance in saleList) { var dataRow = dtsModel.Tables[1].NewRow(); foreach (var propertyInfo in propertyInfos) dataRow[propertyInfo.Name] = propertyInfo.GetValue(objInstance, null); dtsModel.Tables[1].Rows.Add(dataRow); } if (chbShowQuantity.Checked) { var rptSaleOrderQuantity = new CsrSaleOrderQuantity(); rptSaleOrderQuantity.SetDataSource(dtsModel); crvReport.ReportSource = rptSaleOrderQuantity; } else if(chbShowBenefit.Checked) { var rptSaleBenefit = new CsrSaleBenefit(); rptSaleBenefit.SetDataSource(dtsModel); crvReport.ReportSource = rptSaleBenefit; } else { var rptSaleOrder = new CsrSaleOrder(); rptSaleOrder.SetDataSource(dtsModel); crvReport.ReportSource = rptSaleOrder; } }
private void RefreshReportDeposit(bool allDeposit) { if (!UserService.AllowToPerform(Resources.PermissionViewDepositReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } var searchCriteria = !allDeposit ? new List<string> { "(DepositDate BETWEEN CONVERT(DATETIME, '" + dtpStartDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + "', 103) AND CONVERT(DATETIME, '" + dtpStopDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + " 23:59', 103)) ", "(AmountPaidInt < AmountSoldInt) ", "DepositNumber NOT IN (SELECT ReferenceNum FROM TDeposits WHERE ReferenceNum IS NOT NULL) " } : new List<string> { "(DepositDate BETWEEN CONVERT(DATETIME, '" + dtpStartDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + "', 103) AND CONVERT(DATETIME, '" + dtpStopDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + " 23:59', 103)) " }; var assessmentList = _depositService.GetDepositHistories(searchCriteria, false); DataSet dtsModel = new DtsModels(); var propertyInfos = typeof(DepositReport).GetProperties(); foreach (var objInstance in assessmentList) { var dataRow = dtsModel.Tables[3].NewRow(); foreach (var propertyInfo in propertyInfos) dataRow[propertyInfo.Name] = propertyInfo.GetValue(objInstance, null); dtsModel.Tables[3].Rows.Add(dataRow); } var rptDeposit = new CsrDeposit(); rptDeposit.SetDataSource(dtsModel); crvReport.ReportSource = rptDeposit; }
private void RefreshDailyExpenseReport() { if (!UserService.AllowToPerform(Resources.PermissionViewExpenseReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } var searchCriteria = new List<string> { "CONVERT(DATETIME, ExpenseDate, 103) BETWEEN CONVERT(DATETIME, '" + dtpStartDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + "', 103) AND CONVERT(DATETIME, '" + dtpStopDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + " 23:59', 103)" }; var expenseList = _ExpenseService.GetExpenses(searchCriteria); DataSet dtsProduct = new DtsModels(); var propertyInfos = typeof (Expense).GetProperties(); foreach (var objInstance in expenseList) { var dataRow = dtsProduct.Tables["DtbExpenses"].NewRow(); foreach (var propertyInfo in propertyInfos) dataRow[propertyInfo.Name] = propertyInfo.GetValue(objInstance, null); dtsProduct.Tables["DtbExpenses"].Rows.Add(dataRow); } var csrExpense = new CsrExpense(); csrExpense.SetDataSource(dtsProduct); crvReport.ReportSource = csrExpense; }
private void RefreshReportStock() { try { if (rdbStockDetail.Checked) { if (!UserService.AllowToPerform(Resources.PermissionViewDetailStockReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } } else if (rdbStockShort.Checked) { if (!UserService.AllowToPerform(Resources.PermissionViewStockReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } } else { if (!UserService.AllowToPerform(Resources.PermissionViewExpiredProductReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } } var searchCriteria = new List <string> { "QtyInStock > 0" }; if (rdbProductExpired.Checked) { searchCriteria.Add( "LastUpdate <= CONVERT(DATETIME, '" + DateTime.Now.AddMonths(-1).ToString("dd/MM/yyyy") + "', 103)"); } var productList = _ProductService.GetObjects(searchCriteria); DataSet dtsProduct = new DtsModels(); var propertyInfos = typeof(Product).GetProperties(); foreach (var objInstance in productList) { var dataRow = dtsProduct.Tables[0].NewRow(); foreach (var propertyInfo in propertyInfos) { dataRow[propertyInfo.Name] = propertyInfo.GetValue(objInstance, null); } dtsProduct.Tables[0].Rows.Add(dataRow); } if ((rdbStockDetail.Checked) || (rdbProductExpired.Checked)) { var csrCatalog = new CsrCatalog(); csrCatalog.SetDataSource(dtsProduct); crvReport.ReportSource = csrCatalog; } else { var csrCatalogShorten = new CsrCatalogShorten(); csrCatalogShorten.SetDataSource(dtsProduct); crvReport.ReportSource = csrCatalogShorten; } } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }