public string ExportExcel(int userId, System.Collections.Hashtable filters, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; ReportDataObject ds = new ReportDataObject(); try { SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("ShippingPerformanceRpt_function_GetReportData", new SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; if (filters.ContainsKey("Season") && !string.IsNullOrEmpty(filters["Season"].ToString())) { adap.SelectCommand.Parameters.AddWithValue("@Season", filters["Season"].ToString().Replace("'", "''")); } adap.Fill(ds.ShippingPerformanceRpt); ds.AcceptChanges(); return(Library.Helper.CreateReportFileWithEPPlus(ds, "ShippingPerformanceRpt", new List <string>() { "ShippingPerformanceRpt" })); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }
// // CUSTOM FUNCTIONS // public string GetExcelReportData(System.Collections.Hashtable filters, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; ReportDataObject ds = new ReportDataObject(); try { System.Data.SqlClient.SqlDataAdapter adap = new System.Data.SqlClient.SqlDataAdapter(); adap.SelectCommand = new System.Data.SqlClient.SqlCommand("StandardPurchasingPriceMng_function_GetReportData", new System.Data.SqlClient.SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; foreach (string filterKey in filters.Keys) { if (filters[filterKey] != null && !string.IsNullOrEmpty(filters[filterKey].ToString())) { adap.SelectCommand.Parameters.AddWithValue("@" + filterKey, filters[filterKey].ToString()); } } adap.Fill(ds.StandardPurchasingPriceMng_ReportData_View); ds.AcceptChanges(); return(Library.Helper.CreateReportFileWithEPPlus(ds, "StandardPurchasingPrice", new List <string>() { "StandardPurchasingPriceMng_ReportData_View" })); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; return(string.Empty); } }
public string ExportExcel(int userId, System.Collections.Hashtable filters, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; ReportDataObject ds = new ReportDataObject(); try { SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("MIDeltaByClientRpt_function_SearchData", new SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; if (filters.ContainsKey("Season") && !string.IsNullOrEmpty(filters["Season"].ToString())) { adap.SelectCommand.Parameters.AddWithValue("@Season", filters["Season"].ToString().Replace("'", "''")); } int UserID = 0; if (filters.ContainsKey("UserID") && filters["UserID"] != null && !string.IsNullOrEmpty(filters["UserID"].ToString())) { UserID = Convert.ToInt32(filters["UserID"].ToString()); } if (!fwFactory.HasSpecialPermission(UserID, "ViewAllSalesData")) { filters["SaleID"] = UserID; } else { filters["SaleID"] = null; //if (filters.ContainsKey("SaleID") && filters["SaleID"] != null && !string.IsNullOrEmpty(filters["SaleID"].ToString())) //{ // if (Convert.ToInt32(filters["SaleID"].ToString()) == -1) // { // filters["SaleID"] = null; // } //} } if (filters.ContainsKey("SaleID") && filters["SaleID"] != null && !string.IsNullOrEmpty(filters["SaleID"].ToString())) { adap.SelectCommand.Parameters.AddWithValue("@SaleID", filters["SaleID"].ToString().Replace("'", "''")); } adap.Fill(ds.MIDeltaByClientRpt_DeltaByClient_View); ds.AcceptChanges(); return(Library.Helper.CreateReportFileWithEPPlus(ds, "MIDeltaByClient", new List <string>() { "MIDeltaByClientRpt_DeltaByClient_View" })); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }
public string PrintShowroomOverview(out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success, Message = "Export success" }; try { ReportDataObject ds = new ReportDataObject(); SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("ReportMng_ShowroomOverview_function_PrintOverview", new SqlConnection(DALBase.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.TableMappings.Add("Table", "ReportMng_ShowroomOverview_View"); adap.Fill(ds); ds.AcceptChanges(); foreach (var item in ds.ReportMng_ShowroomOverview_View) { if (!item.IsShowroomItemThumbnailImageNull()) { item.ShowroomItemThumbnailImage = FrameworkSetting.Setting.ThumbnailUrl + item.ShowroomItemThumbnailImage; } else { item.ShowroomItemThumbnailImage = "NONE"; } if (!item.IsProductThumbnailImageNull()) { item.ProductThumbnailImage = FrameworkSetting.Setting.ThumbnailUrl + item.ProductThumbnailImage; } else { item.ProductThumbnailImage = "NONE"; } } //dev //DALBase.Helper.DevCreateReportXMLSource(ds, "ShowroomOverview"); //return string.Empty; // generate xml file string result = DALBase.Helper.CreateReportFiles(ds, "ShowroomOverview"); return(result); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; notification.DetailMessage.Add(ex.Message); if (ex.GetBaseException() != null) { notification.DetailMessage.Add(ex.GetBaseException().Message); } return(string.Empty); } }
public string GetReportData(int userID, string Season, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; ReportDataObject ds = new ReportDataObject(); try { SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("DDCRpt_function_GetData", new SqlConnection(DALBase.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@Season", Season); adap.SelectCommand.Parameters.AddWithValue("@UserID", userID); adap.TableMappings.Add("Table", "DDCRpt_ClientInfo_View"); adap.TableMappings.Add("Table1", "DDCRpt_Sale_View"); adap.TableMappings.Add("Table2", "Report_Setting_View"); adap.Fill(ds); // change string to numeric value //foreach (ReportDataObject.Report_Setting_ViewRow sRow in ds.Report_Setting_View) //{ // if (!sRow.IsSettingValueNull()) // { // sRow.SettingValue = sRow.SettingValue.Replace(".", ","); // } //} // add report param ReportDataObject.ReportParamRow pRow = ds.ReportParam.NewReportParamRow(); pRow.Season = Season; pRow.PreSeason = Library.OMSHelper.Helper.GetPrevSeason(Season); ds.ReportParam.AddReportParamRow(pRow); ds.AcceptChanges(); return(Library.Helper.CreateReportFileWithEPPlus(ds, "DDCReport", new List <string>() { "DDCRpt_ClientInfo_View", "DDCRpt_Sale_View", "Report_Setting_View", "ReportParam" })); // generate xml file //return DALBase.Helper.CreateReportFiles(ds, "DDCReport"); //return Library.Helper.CreateCOMReportFileImportDataOnly(ds, "DDCReport"); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }
public string ExportExcel(int userId, System.Collections.Hashtable filters, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; ReportDataObject ds = new ReportDataObject(); string ArticleCode = null; string Description = null; string Season = null; if (filters.ContainsKey("ArticleCode")) { ArticleCode = filters["ArticleCode"].ToString().Replace("'", "''"); } if (filters.ContainsKey("Description")) { Description = filters["Description"].ToString().Replace("'", "''"); } if (filters.ContainsKey("Season") && filters["Season"] != null && !string.IsNullOrEmpty(filters["Season"].ToString())) { Season = filters["Season"].ToString().Replace("'", "''"); } try { System.Data.SqlClient.SqlDataAdapter adap = new System.Data.SqlClient.SqlDataAdapter(); adap.SelectCommand = new System.Data.SqlClient.SqlCommand("StandardCostPriceOverviewRpt_function_ExportProduct", new System.Data.SqlClient.SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@Season", Season); adap.SelectCommand.Parameters.AddWithValue("@ArticleCode", ArticleCode); adap.SelectCommand.Parameters.AddWithValue("@Description", Description); adap.TableMappings.Add("Table", "StandardCostPriceOverviewRpt_ProductSearchResult_View"); adap.Fill(ds); ds.AcceptChanges(); return(Library.Helper.CreateReportFileWithEPPlus(ds, "StandardCostPriceOverviewRpt")); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }
public string GetExcelReportData(int?factoryId, string clientUd, string season, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; ReportDataObject ds = new ReportDataObject(); try { SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("PurchasingPriceOverview2Rpt_function_GetExcelReportData", new SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; if (factoryId.HasValue) { adap.SelectCommand.Parameters.AddWithValue("@FactoryID", factoryId); } if (!string.IsNullOrEmpty(clientUd)) { adap.SelectCommand.Parameters.AddWithValue("@ClientUD", clientUd); } if (!string.IsNullOrEmpty(season)) { adap.SelectCommand.Parameters.AddWithValue("@Season", season); } adap.Fill(ds.PurchasingPriceOverview2Rpt_ExcelReportData_View); ReportDataObject.ReportHeaderRow row = ds.ReportHeader.NewReportHeaderRow(); row.Season = season; ds.ReportHeader.AddReportHeaderRow(row); ds.AcceptChanges(); // dev //Library.Helper.DevCreateReportXMLSource(ds, "MissingShippingInfo"); // generate xml file return(Library.Helper.CreateReportFileWithEPPlus(ds, "PurchasingPriceOverview2")); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }
public string GetExportExcelFile(out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success, Message = "Export success" }; try { ReportDataObject ds = new ReportDataObject(); SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("ShowroomItemMng_function_GetExportExcel_ShowroomItem", new SqlConnection(DALBase.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.TableMappings.Add("Table", "ShowroomItemMng_ExportExcel_ShowroomItem_View"); adap.Fill(ds); ds.AcceptChanges(); //foreach (var item in ds.ShowroomItemMng_ExportExcel_ShowroomItem_View.Where(o => !o.IsArticleCodeNull())) //{ // item.BarCode = BarCode.BarcodeConverter39.StringToBarcode(item.ArticleCode); // //string qrCode = FrameworkSetting.Setting.ReportTempUrl + Library.Helper.QRCodeImageFile("abcd"); //} //dev //DALBase.Helper.DevCreateReportXMLSource(ds, "ShowroomItem"); //return string.Empty; // generate xml file string result = DALBase.Helper.CreateReportFiles(ds, "ShowroomItem"); return(result); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; notification.DetailMessage.Add(ex.Message); if (ex.GetBaseException() != null) { notification.DetailMessage.Add(ex.GetBaseException().Message); } return(string.Empty); } }
// // CUSTOM FUNCTION // // // CUSTOM FUNCTION // public string GetExcelReportData(string season, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; ReportDataObject ds = new ReportDataObject(); try { SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("FactoryPaymentSummaryRpt_function_getReportData", new SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@Season", season); adap.Fill(ds.FactoryPaymentSummaryRpt_function_getReportData); ReportDataObject.ReportHeaderRow row = ds.ReportHeader.NewReportHeaderRow(); row.Season = season; ds.ReportHeader.AddReportHeaderRow(row); ds.AcceptChanges(); // dev //Library.Helper.DevCreateReportXMLSource(ds, "FactoryPaymentOverview"); //return string.Empty; // generate xml file return(Library.Helper.CreateCOMReportFile(ds, "FactoryPaymentSummary")); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }
public string GetExportData(int ProductSpecificationID, out Library.DTO.Notification notification) { notification = new Notification() { Type = NotificationType.Success }; ReportDataObject ds = new ReportDataObject(); try { System.Data.SqlClient.SqlDataAdapter adap = new System.Data.SqlClient.SqlDataAdapter(); adap.SelectCommand = new System.Data.SqlClient.SqlCommand("SpecificationOfProductMng_Function_GetExport", new System.Data.SqlClient.SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@ProductSpecificationID", ProductSpecificationID); adap.TableMappings.Add("Table", "SpecificationOfProductMng_SpecificationOfproduct_Rpt"); adap.TableMappings.Add("Table1", "SpecificationOfProductMng_SpecificationImage_Rpt"); adap.TableMappings.Add("Table2", "SpecificationOfProductMng_SpecificationWoodenPart_Rpt"); adap.TableMappings.Add("Table3", "SpecificationOfProductMng_SpecificationWeavingFile_Rpt"); adap.TableMappings.Add("Table4", "SpecificationOfProductMng_SpecificationCushionImage_Rpt"); adap.TableMappings.Add("Table5", "SpecificationOfProductMng_SpecificationPacking_Rpt"); adap.Fill(ds); ds.AcceptChanges(); return(Library.Helper.CreateReportFileWithEPPlus(ds, "SpecificationOfProduct")); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }
public string GetStockOverviewWithDetail(out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; try { ReportDataObject ds = new ReportDataObject(); SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("ReportMng_function_GetStockOverviewWithDetail", new SqlConnection(DALBase.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.TableMappings.Add("Table", "ReportMng_StockOverview_View"); adap.TableMappings.Add("Table1", "ReportMng_StockReservation_View"); adap.TableMappings.Add("Table2", "ReportMng_StockReservationProduct_View"); adap.TableMappings.Add("Table3", "ReportMng_StockClient_View"); //adap.TableMappings.Add("Table4", "ReportMng_ImportedOverview_View"); //adap.TableMappings.Add("Table5", "ReportMng_OrderOverview_View"); //adap.TableMappings.Add("Table6", "ReportMng_ReservationOverview_View"); //adap.TableMappings.Add("Table7", "ReportMng_PickingListOverview_View"); //adap.TableMappings.Add("Table8", "ReportMng_ExportedOverview_View"); adap.Fill(ds); // encode string for barcode //foreach (ReportDataObject.ReportMng_StockOverview_ViewRow row in ds.ReportMng_StockOverview_View) //{ // if (row.IsBarCodeNull()) // { // row.BarCode = BarCode.BarcodeConverter128.StringToBarcode(row.ArticleCode); // } //} //foreach (ReportDataObject.ReportMng_StockReservationProduct_ViewRow row in ds.ReportMng_StockReservationProduct_View) //{ // if (row.IsBarCodeNull()) // { // row.BarCode = BarCode.BarcodeConverter128.StringToBarcode(row.ArticleCode); // } //} ds.AcceptChanges(); //dev //DALBase.Helper.DevCreateReportXMLSource(ds, "StockOverview"); //return string.Empty; // generate xml file string result = string.Empty; result = DALBase.Helper.CreateReportFiles(ds, "ReportStockOverviewWithDetail"); if (string.IsNullOrEmpty(result)) { notification.Type = Library.DTO.NotificationType.Error; return(string.Empty); } return(result); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; notification.DetailMessage.Add(ex.Message); if (ex.GetBaseException() != null) { notification.DetailMessage.Add(ex.GetBaseException().Message); } return(string.Empty); } }
public string GetFreeToSaleSelected(Hashtable filters, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success, Message = "Get report success" }; try { string KeyIDs = ""; int? ClientID = null; if (filters.ContainsKey("KeyIDs") && filters["KeyIDs"] != null) { KeyIDs = filters["KeyIDs"].ToString(); } if (filters.ContainsKey("ClientID") && filters["ClientID"] != null) { ClientID = Convert.ToInt32(filters["ClientID"]); } ReportDataObject ds = new ReportDataObject(); SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("ReportMng_action_GetFreeToSaleSelected", new SqlConnection(DALBase.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@KeyIDs", KeyIDs); adap.SelectCommand.Parameters.AddWithValue("@ClientID", ClientID); adap.TableMappings.Add("Table", "ReportMng_FreeToSaleOverview_View"); adap.TableMappings.Add("Table1", "Client"); adap.Fill(ds); ds.AcceptChanges(); foreach (var item in ds.Client) { if (!item.IsLogoImageNull() && System.IO.File.Exists(FrameworkSetting.Setting.AbsoluteThumbnailFolder + item.LogoImage)) { item.LogoImage = FrameworkSetting.Setting.ThumbnailUrl + item.LogoImage; } else { item.LogoImage = "NONE"; } } //appy image foreach (var item in ds.ReportMng_FreeToSaleOverview_View) { if (!item.IsSelectedThumbnailImageNull() && System.IO.File.Exists(FrameworkSetting.Setting.AbsoluteThumbnailFolder + item.SelectedThumbnailImage)) { item.SelectedThumbnailImage = FrameworkSetting.Setting.ThumbnailUrl + item.SelectedThumbnailImage; } else { item.SelectedThumbnailImage = "NONE"; } if (!item.IsSelectedFullImageNull() && System.IO.File.Exists(FrameworkSetting.Setting.AbsoluteFileFolder + item.SelectedFullImage)) { item.SelectedFullImage = FrameworkSetting.Setting.FullSizeUrl + item.SelectedFullImage; } else { item.SelectedFullImage = "NONE"; } if (!item.IsProductGardenFullImageNull() && System.IO.File.Exists(FrameworkSetting.Setting.AbsoluteFileFolder + item.ProductGardenFullImage)) { item.ProductGardenFullImage = FrameworkSetting.Setting.FullSizeUrl + item.ProductGardenFullImage; } else { item.ProductGardenFullImage = "NONE"; } if (!item.IsCushionImageNull() && System.IO.File.Exists(FrameworkSetting.Setting.AbsoluteThumbnailFolder + item.CushionImage)) { item.CushionImage = FrameworkSetting.Setting.ThumbnailUrl + item.CushionImage; } else { item.CushionImage = "NONE"; } if (!item.IsMaterialImageNull() && System.IO.File.Exists(FrameworkSetting.Setting.AbsoluteThumbnailFolder + item.MaterialImage)) { item.MaterialImage = FrameworkSetting.Setting.ThumbnailUrl + item.MaterialImage; } else { item.MaterialImage = "NONE"; } } //dev //DALBase.Helper.DevCreateReportXMLSource(ds, "ReportFreeToSaleSelected"); //return string.Empty; // generate xml file string result = DALBase.Helper.CreateReportFiles(ds, "ReportFreeToSaleSelected"); if (string.IsNullOrEmpty(result)) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = "Can not create report"; return(string.Empty); } return(result); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; notification.DetailMessage.Add(ex.Message); if (ex.GetBaseException() != null) { notification.DetailMessage.Add(ex.GetBaseException().Message); } return(string.Empty); } }
public string GetReportData(string season, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success, Message = "Print Success" }; ReportDataObject dsReport = new ReportDataObject(); try { SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("DocumentClientMng_function_GetReportData", new SqlConnection(DALBase.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandTimeout = 600; adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@Season", season); adap.TableMappings.Add("Table", "DocumentClientMng_DocumentClient_ReportView"); adap.TableMappings.Add("Table1", "DocumentClientMng_OrderInfo_View"); adap.Fill(dsReport); ////get list documentclientID //var documentClientIDs = from p in dsReport.DocumentClientMng_DocumentClient_ReportView.Where(o => !o.IsDocumentClientIDNull()) group p by new { p.DocumentClientID } into g select new { g.Key.DocumentClientID }; ////compite data report //foreach (var idItem in documentClientIDs) //{ // int i = 1; // foreach (ReportDataObject.DocumentClientMng_DocumentClient_ReportViewRow documentItem in dsReport.DocumentClientMng_DocumentClient_ReportView.Where(o => !o.IsDocumentClientIDNull() && o.DocumentClientID == idItem.DocumentClientID)) // { // if (i > 1) // { // documentItem["DC20"] = DBNull.Value; // documentItem["DC40"] = DBNull.Value; // documentItem["HC40"] = DBNull.Value; // documentItem["CostOfDemurage1"] = DBNull.Value; // documentItem["CostOfDemurage2"] = DBNull.Value; // } // i++; // } //} //SET Order Info for containers that were not put in ecommercialinvoice foreach (var item in dsReport.DocumentClientMng_DocumentClient_ReportView.Where(o => !o.IsDocumentClientIDNull() && (o.IsClientUDNull() || o.IsClientNMNull() || o.IsSaleNMNull()))) { // cuong.tran - 07-Jan-2018 - start //item.ClientUD = ""; //item.ClientNM = ""; // cuong.tran - 07-Jan-2018 - e n d item.SaleNM = ""; //foreach (var dbOrder in dsReport.DocumentClientMng_OrderInfo_View.Where(o => !o.IsDocumentClientIDNull() && o.DocumentClientID == item.DocumentClientID)) //{ // if (!dbOrder.IsClientUDNull() && !item.ClientUD.Contains(dbOrder.ClientUD)) item.ClientUD += dbOrder.ClientUD + "/ "; // if (!dbOrder.IsClientNMNull() && !item.ClientNM.Contains(dbOrder.ClientNM)) item.ClientNM += dbOrder.ClientNM + "/ "; // if (!dbOrder.IsSaleNMNull() && !item.SaleNM.Contains(dbOrder.SaleNM)) item.SaleNM += dbOrder.SaleNM + "/ "; //} //if (item.ClientUD.Length > 2) item.ClientUD = item.ClientUD.Substring(0, item.ClientUD.Length - 2); //if (item.ClientNM.Length > 2) item.ClientNM = item.ClientNM.Substring(0, item.ClientNM.Length - 2); //if (item.SaleNM.Length > 2) item.SaleNM = item.SaleNM.Substring(0, item.SaleNM.Length - 2); if (dsReport.DocumentClientMng_OrderInfo_View.Count(o => !o.IsDocumentClientIDNull() && o.DocumentClientID == item.DocumentClientID) > 0) { // cuong.tran - 07-Jan-2018 - start //item.ClientUD = dsReport.DocumentClientMng_OrderInfo_View.Where(o => !o.IsDocumentClientIDNull() && o.DocumentClientID == item.DocumentClientID).Select(o => o.ClientUD).Distinct().Aggregate((i, j) => i + " / " + j); //item.ClientNM = dsReport.DocumentClientMng_OrderInfo_View.Where(o => !o.IsDocumentClientIDNull() && o.DocumentClientID == item.DocumentClientID).Select(o => o.ClientNM).Distinct().Aggregate((i, j) => i + " / " + j); // cuong.tran - 07-Jan-2018 - e n d item.SaleNM = dsReport.DocumentClientMng_OrderInfo_View.Where(o => !o.IsDocumentClientIDNull() && o.DocumentClientID == item.DocumentClientID).Select(o => o.SaleNM).Distinct().Aggregate((i, j) => i + " / " + j); } } dsReport.AcceptChanges(); // DALBase.Helper.DevCreateReportXMLSource(dsReport, "DocumentClient"); return(DALBase.Helper.CreateReportFiles(dsReport, "DocumentClient")); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; notification.DetailMessage.Add(ex.Message); if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }
// // CUSTOM FUNCTION // public string GetExcelReportData(string Season, string clientId, int?vnFactoryId, int?sampleProductStatusID, int?sampleOrderStatusID, int?sampleOrderID, bool canEdit, bool canRead, int userId, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; ReportDataObject ds = new ReportDataObject(); try { SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("SampleOrderOverviewRpt_function_GetReportData", new SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@Season", Season); adap.SelectCommand.Parameters.AddWithValue("@ClientID", clientId); // Add filter to export data // Can edit to see all items. // Can read only to see item in VN suggested factory of end-user manage adap.SelectCommand.Parameters.AddWithValue("@CanEdit", canEdit); adap.SelectCommand.Parameters.AddWithValue("@CanRead", canRead); adap.SelectCommand.Parameters.AddWithValue("@UserID", userId); if (vnFactoryId.HasValue) { adap.SelectCommand.Parameters.AddWithValue("@VNSuggestedFactoryID", vnFactoryId.Value); } if (sampleProductStatusID.HasValue) { adap.SelectCommand.Parameters.AddWithValue("@SampleProductStatusID", sampleProductStatusID.Value); } if (sampleOrderStatusID.HasValue) { adap.SelectCommand.Parameters.AddWithValue("@SampleOrderStatusID", sampleOrderStatusID.Value); } if (sampleOrderID.HasValue) { adap.SelectCommand.Parameters.AddWithValue("@SampleOrderID", sampleOrderID.Value); } adap.TableMappings.Add("Table", "SampleOrderOverviewRpt_ReportData_View"); adap.TableMappings.Add("Table1", "SampleOrderOverviewRpt_ReportMinuteData_View"); adap.TableMappings.Add("Table2", "SampleOrderOverviewRpt_ReportRemarkData_View"); adap.TableMappings.Add("Table3", "SampleOrderOverviewRpt_ReportSampleOrder_View"); adap.TableMappings.Add("Table4", "SampleOrderOverviewRpt_ReportQARemarkData_View"); adap.Fill(ds); ReportDataObject.ReportHeaderRow hRow = ds.ReportHeader.NewReportHeaderRow(); hRow.Season = Season; ds.ReportHeader.AddReportHeaderRow(hRow); // processing data and cleanup int sampleProductID = -1; string bigRemark = string.Empty; foreach (DAL.ReportDataObject.SampleOrderOverviewRpt_ReportData_ViewRow row in ds.SampleOrderOverviewRpt_ReportData_View) { sampleProductID = row.SampleProductID; bigRemark = string.Empty; foreach (DAL.ReportDataObject.SampleOrderOverviewRpt_ReportQARemarkData_ViewRow mRow in ds.SampleOrderOverviewRpt_ReportQARemarkData_View.Where(o => o.SampleProductID == sampleProductID)) { bigRemark += mRow.IndexNumber.ToString() + ". " + mRow.UpdatorName + "(" + mRow.DisplayUpdatedDate + ")"; bigRemark += Environment.NewLine + mRow.Remark + Environment.NewLine + Environment.NewLine; } row.LastMinuteTableRemark = bigRemark; bigRemark = string.Empty; foreach (DAL.ReportDataObject.SampleOrderOverviewRpt_ReportRemarkData_ViewRow rRow in ds.SampleOrderOverviewRpt_ReportRemarkData_View.Where(o => o.SampleProductID == sampleProductID)) { bigRemark += rRow.IndexNumber.ToString() + ". " + rRow.UpdatorName + "(" + rRow.DisplayUpdatedDate + ")"; bigRemark += Environment.NewLine + rRow.Remark + Environment.NewLine + Environment.NewLine; } row.InternRemark = bigRemark; row.Barcode = Library.Helper.QRCodeImageFile(row.SampleProductUD); } ds.Tables.Remove("SampleOrderOverviewRpt_ReportMinuteData_View"); ds.Tables.Remove("SampleOrderOverviewRpt_ReportRemarkData_View"); ds.Tables.Remove("SampleOrderOverviewRpt_ReportQARemarkData_View"); ds.AcceptChanges(); // generate xml file //return Library.Helper.CreateReportFileWithEPPlus(ds, "SampleOrderOverview"); return(Library.Helper.CreateReportFileWithEPPlus(ds, "SampleOrderOverview", new List <string>() { "SampleOrderOverviewRpt_ReportData_View", "SampleOrderOverviewRpt_ReportSampleOrder_View", "ReportHeader" })); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }
public string GetGetOutStandingBalance(string Season, int SupplierID, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success, Message = "Get report data sucess" }; ReportDataObject ds = new ReportDataObject(); try { SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("FactoryPayment_function_GetOutStandingBalance", new SqlConnection(DALBase.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@Season", Season); adap.SelectCommand.Parameters.AddWithValue("@SupplierID", SupplierID); adap.TableMappings.Add("Table", "FactoryPayment_FactoryInvoice_ReportView"); adap.TableMappings.Add("Table1", "FactoryPayment_FactoryPayment_ReportView"); adap.TableMappings.Add("Table2", "FactoryPayment_FactoryInvoiceDetail_ReportView"); adap.Fill(ds); //create report data if (ds.FactoryPayment_FactoryInvoice_ReportView.Count() > ds.FactoryPayment_FactoryPayment_ReportView.Count()) { for (int i = 0; i < ds.FactoryPayment_FactoryInvoice_ReportView.Count; i++) { DataRow drNew = ds.Invoice.NewRow(); drNew["No"] = i + 1; drNew["Season"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["Season"]; drNew["SupplierUD"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["SupplierUD"]; drNew["FactoryInvoiceNo"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["FactoryInvoiceNo"]; drNew["InvoiceDate"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["InvoiceDate"]; drNew["Company"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["Company"]; drNew["ClientUD"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["ClientUD"]; drNew["InvoiceAmount"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["InvoiceAmount"]; drNew["CumulationInvoiceAmount"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["CumulationInvoiceAmount"]; drNew["EuroFurnidoInvoiceAmount"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["EuroFurnidoInvoiceAmount"]; if (i < ds.FactoryPayment_FactoryPayment_ReportView.Count) { drNew["PaymentDate"] = ds.FactoryPayment_FactoryPayment_ReportView[i]["PaymentDate"]; drNew["PaymentReceiptNo"] = ds.FactoryPayment_FactoryPayment_ReportView[i]["PaymentReceiptNo"]; drNew["USDAmount"] = ds.FactoryPayment_FactoryPayment_ReportView[i]["USDAmount"]; } ds.Invoice.Rows.Add(drNew); } } else { for (int i = 0; i < ds.FactoryPayment_FactoryPayment_ReportView.Count; i++) { DataRow drNew = ds.Invoice.NewRow(); drNew["No"] = i + 1; if (i < ds.FactoryPayment_FactoryInvoice_ReportView.Count) { drNew["Season"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["Season"]; drNew["SupplierUD"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["SupplierUD"]; drNew["FactoryInvoiceNo"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["FactoryInvoiceNo"]; drNew["InvoiceDate"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["InvoiceDate"]; drNew["Company"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["Company"]; drNew["ClientUD"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["ClientUD"]; drNew["InvoiceAmount"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["InvoiceAmount"]; drNew["CumulationInvoiceAmount"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["CumulationInvoiceAmount"]; drNew["EuroFurnidoInvoiceAmount"] = ds.FactoryPayment_FactoryInvoice_ReportView[i]["EuroFurnidoInvoiceAmount"]; } drNew["PaymentDate"] = ds.FactoryPayment_FactoryPayment_ReportView[i]["PaymentDate"]; drNew["PaymentReceiptNo"] = ds.FactoryPayment_FactoryPayment_ReportView[i]["PaymentReceiptNo"]; drNew["USDAmount"] = ds.FactoryPayment_FactoryPayment_ReportView[i]["USDAmount"]; ds.Invoice.Rows.Add(drNew); } } //MODIFY Client foreach (var dr1 in ds.Invoice.Where(o => !o.IsFactoryInvoiceNoNull())) { dr1.ClientUD = ""; foreach (var dr2 in ds.FactoryPayment_FactoryInvoiceDetail_ReportView.Where(o => !o.IsFactoryInvoiceNoNull() && o.FactoryInvoiceNo == dr1.FactoryInvoiceNo)) { if (!dr2.IsClientUDNull() && !dr1.ClientUD.Contains(dr2.ClientUD)) { dr1.ClientUD += dr2.ClientUD + ","; } } if (dr1.ClientUD.Length > 2 && dr1.ClientUD.Contains(",")) { dr1.ClientUD = dr1.ClientUD.Substring(0, dr1.ClientUD.Length - 1); } } //invoice detail if (ds.FactoryPayment_FactoryInvoiceDetail_ReportView.Count >= ds.FactoryPayment_FactoryPayment_ReportView.Count) { for (int i = 0; i < ds.FactoryPayment_FactoryInvoiceDetail_ReportView.Count; i++) { DataRow drNew = ds.InvoiceDetail.NewRow(); drNew["No"] = i + 1; drNew["ProformaInvoiceNo"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["ProformaInvoiceNo"]; drNew["ClientUD"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["ClientUD"]; drNew["ArticleCode"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["ArticleCode"]; drNew["Description"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["Description"]; drNew["ContainerNo"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["ContainerNo"]; drNew["Quantity"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["Quantity"]; drNew["PurchasingPrice"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["PurchasingPrice"]; drNew["Amount"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["Amount"]; drNew["TotalAmount"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["TotalAmount"]; drNew["FactoryInvoiceNo"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["FactoryInvoiceNo"]; drNew["OrderQnt"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["OrderQnt"]; drNew["CostPrice"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["CostPrice"]; drNew["CostAmount"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["CostAmount"]; if (i < ds.FactoryPayment_FactoryPayment_ReportView.Count) { drNew["PaymentReceiptNo"] = ds.FactoryPayment_FactoryPayment_ReportView[i]["PaymentReceiptNo"]; drNew["PaymentDate"] = ds.FactoryPayment_FactoryPayment_ReportView[i]["PaymentDate"]; drNew["USDAmount"] = ds.FactoryPayment_FactoryPayment_ReportView[i]["USDAmount"]; } ds.InvoiceDetail.Rows.Add(drNew); } } else { for (int i = 0; i < ds.FactoryPayment_FactoryPayment_ReportView.Count; i++) { DataRow drNew = ds.InvoiceDetail.NewRow(); drNew["No"] = i + 1; drNew["FactoryInvoiceNo"] = "-"; drNew["ContainerNo"] = "-"; if (i < ds.FactoryPayment_FactoryInvoiceDetail_ReportView.Count) { drNew["ProformaInvoiceNo"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["ProformaInvoiceNo"]; drNew["ClientUD"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["ClientUD"]; drNew["ArticleCode"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["ArticleCode"]; drNew["Description"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["Description"]; drNew["ContainerNo"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["ContainerNo"]; drNew["Quantity"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["Quantity"]; drNew["PurchasingPrice"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["PurchasingPrice"]; drNew["Amount"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["Amount"]; drNew["TotalAmount"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["TotalAmount"]; drNew["FactoryInvoiceNo"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["FactoryInvoiceNo"]; drNew["OrderQnt"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["OrderQnt"]; drNew["CostPrice"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["CostPrice"]; drNew["CostAmount"] = ds.FactoryPayment_FactoryInvoiceDetail_ReportView[i]["CostAmount"]; } drNew["PaymentReceiptNo"] = ds.FactoryPayment_FactoryPayment_ReportView[i]["PaymentReceiptNo"]; drNew["PaymentDate"] = ds.FactoryPayment_FactoryPayment_ReportView[i]["PaymentDate"]; drNew["USDAmount"] = ds.FactoryPayment_FactoryPayment_ReportView[i]["USDAmount"]; ds.InvoiceDetail.Rows.Add(drNew); } } //PREPARE No AND CALCAULATE SUM var items = from o in ds.InvoiceDetail.ToList() group o by new { o.FactoryInvoiceNo, o.ContainerNo } into g select new { g.Key.FactoryInvoiceNo, g.Key.ContainerNo, TotalAmount = g.Sum(o => (o.IsAmountNull() ? 0 : o.Amount)) }; int j = 1; int k = 1; foreach (var item in items) { k = 1; foreach (var dr in ds.InvoiceDetail .Where(o => o.FactoryInvoiceNo == item.FactoryInvoiceNo && o.ContainerNo == item.ContainerNo).ToArray()) { dr.No = j; if (k == 1) { dr.TotalAmount = item.TotalAmount; } else { dr.TotalAmount = 0; } k += 1; } j += 1; } ds.AcceptChanges(); // dev //DALBase.Helper.DevCreateReportXMLSource(ds, "RAPEU"); // generate xml file return(DALBase.Helper.CreateReportFiles(ds, "FactoryOutStandingBalance")); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }
public string GetStockOverview(Hashtable filters, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success, Message = "Get report success" }; try { ReportDataObject ds = new ReportDataObject(); string season = string.Empty; int month = DateTime.Now.Month; bool isIncludeImage = false; bool isIncludeDailyImageProduct = false; if (filters.ContainsKey("season") && filters["season"] != null) { season = filters["season"].ToString(); } if (filters.ContainsKey("month") && filters["month"] != null) { month = Convert.ToInt32(filters["month"]); } if (filters.ContainsKey("isIncludeImage") && filters["isIncludeImage"] != null) { isIncludeImage = Convert.ToBoolean(filters["isIncludeImage"]); } if (filters.ContainsKey("isIncludeDailyImageProduct") && filters["isIncludeDailyImageProduct"] != null) { isIncludeDailyImageProduct = Convert.ToBoolean(filters["isIncludeDailyImageProduct"]); } SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("ReportMng_function_GetStockOverview", new SqlConnection(DALBase.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@Season", season); adap.SelectCommand.Parameters.AddWithValue("@Month", month); adap.SelectCommand.Parameters.AddWithValue("@IsIncludeImage", isIncludeImage); adap.SelectCommand.Parameters.AddWithValue("@IsIncludeDailyImageProduct", isIncludeDailyImageProduct); adap.TableMappings.Add("Table", "ParamTable"); adap.TableMappings.Add("Table1", "ReportMng_StockOverview_View"); adap.TableMappings.Add("Table2", "ReportMng_StockReservation_View"); adap.TableMappings.Add("Table3", "ReportMng_StockReservationProduct_View"); adap.TableMappings.Add("Table4", "ReportMng_StockClient_View"); adap.TableMappings.Add("Table5", "ReportMng_StockOverview_PhysicalStock_View"); adap.TableMappings.Add("Table6", "ReportMng_StockOverview_ProductImportRemark_View"); adap.TableMappings.Add("Table7", "DailyInMonth"); adap.TableMappings.Add("Table8", "ReportMng_StockDaily_Imported_View"); adap.TableMappings.Add("Table9", "ReportMng_StockDaily_Picked_View"); adap.TableMappings.Add("Table10", "ReportMng_StockDaily_Product_View"); adap.Fill(ds); // encode string for barcode foreach (ReportDataObject.ReportMng_StockOverview_ViewRow row in ds.ReportMng_StockOverview_View) { //if (!row.IsArticleCodeNull()) //{ // row.BarCode = BarCode.BarcodeConverter128.StringToBarcode(row.ArticleCode); //} if (!row.IsKeyIDNull()) { //add location row.WarehouseAreaUD = ""; row.QntPerWarehouseArea = ""; foreach (var item in ds.ReportMng_StockOverview_PhysicalStock_View.Where(o => !o.IsKeyIDNull() && !o.IsWarehouseAreaUDNull() && o.KeyID == row.KeyID)) { row.WarehouseAreaUD += item.WarehouseAreaUD + " / "; row.QntPerWarehouseArea += item.PhysicalQnt.ToString() + " / "; } //add remark string remark = ""; foreach (var item in ds.ReportMng_StockOverview_ProductImportRemark_View.Where(o => !o.IsKeyIDNull() && o.KeyID == row.KeyID)) { remark += item.Remark + "\n"; } if (!string.IsNullOrEmpty(remark)) { row.Description = row.Description + "\n\nREMARK: " + remark; } } if (isIncludeImage && System.IO.File.Exists(FrameworkSetting.Setting.AbsoluteThumbnailFolder + row.ImageFile)) { row.ImageFile = FrameworkSetting.Setting.ThumbnailUrl + row.ImageFile; } else { row.ImageFile = "NONE"; } } foreach (ReportDataObject.ReportMng_StockReservationProduct_ViewRow row in ds.ReportMng_StockReservationProduct_View) { //if (!row.IsArticleCodeNull()) //{ // row.BarCode = BarCode.BarcodeConverter128.StringToBarcode(row.ArticleCode); //} if (isIncludeImage && System.IO.File.Exists(FrameworkSetting.Setting.AbsoluteThumbnailFolder + row.ImageFile)) { row.ImageFile = FrameworkSetting.Setting.ThumbnailUrl + row.ImageFile; } else { row.ImageFile = "NONE"; } } foreach (var row in ds.ReportMng_StockDaily_Product_View) { //if (!row.IsArticleCodeNull()) //{ // row.Barcode = BarCode.BarcodeConverter128.StringToBarcode(row.ArticleCode); //} if (isIncludeDailyImageProduct && !row.IsSelectedThumbnailImageNull() && System.IO.File.Exists(FrameworkSetting.Setting.AbsoluteThumbnailFolder + row.SelectedThumbnailImage)) { row.SelectedThumbnailImage = FrameworkSetting.Setting.ThumbnailUrl + row.SelectedThumbnailImage; } else { row.SelectedThumbnailImage = "NONE"; } } ds.AcceptChanges(); //dev //DALBase.Helper.DevCreateReportXMLSource(ds, "StockOverview"); //return string.Empty; // generate xml file string result = string.Empty; //if (includeImage) //{ // result = DALBase.Helper.CreateReportFiles(ds, "ReportStockOverviewWithImage"); //} //else //{ // result = DALBase.Helper.CreateReportFiles(ds, "ReportStockOverview"); //} result = DALBase.Helper.CreateReportFiles(ds, "ReportStockOverview"); if (string.IsNullOrEmpty(result)) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = "Can not create report"; return(string.Empty); } return(result); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; notification.DetailMessage.Add(ex.Message); if (ex.GetBaseException() != null) { notification.DetailMessage.Add(ex.GetBaseException().Message); } return(string.Empty); } }
public string PrintHangTag(string keyIDs, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success, Message = "Export success" }; try { ReportDataObject ds = new ReportDataObject(); SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("ReportMng_ShowroomOverview_function_PrintHangTag", new SqlConnection(DALBase.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@KeyIDs", keyIDs); adap.TableMappings.Add("Table", "ReportMng_ShowroomOverview_HangTag_View"); adap.TableMappings.Add("Table1", "ReportMng_ShowroomOverview_HangTag_Cushion_View"); adap.TableMappings.Add("Table2", "ReportMng_ShowroomOverview_HangTag_Pieces_View"); adap.Fill(ds); ds.AcceptChanges(); foreach (var item in ds.ReportMng_ShowroomOverview_HangTag_View) { if (!item.IsModelImageNull()) { item.ModelImage = FrameworkSetting.Setting.ThumbnailUrl + item.ModelImage; } else { item.ModelImage = "NONE"; } if (!item.IsProductIDNull()) { item.QRCodeProductImage = FrameworkSetting.Setting.ReportTempUrl + Library.Helper.QRCodeImageFile("http://app.tilsoft.bg/Product/Edit/" + item.ProductID.ToString()); } else { item.QRCodeProductImage = "NONE"; } if (!item.IsShowroomItemIDNull()) { item.QRCodeShowroomItemImage = FrameworkSetting.Setting.ReportTempUrl + Library.Helper.QRCodeImageFile("http://app.tilsoft.bg/ShowroomItem/Edit/" + item.ShowroomItemID.ToString()); } else { item.QRCodeShowroomItemImage = "NONE"; } //item.ShowroomItemBarCode = BarCode.BarcodeConverter39.StringToBarcode(item.ShowroomArt); //item.ShowroomAreaBarCode = BarCode.BarcodeConverter39.StringToBarcode(item.ShowroomAreaUD); } foreach (var item in ds.ReportMng_ShowroomOverview_HangTag_Pieces_View) { if (!item.IsPieceThumbImageNull()) { item.PieceThumbImage = FrameworkSetting.Setting.ThumbnailUrl + item.PieceThumbImage; } else { item.PieceThumbImage = "NONE"; } } //dev //DALBase.Helper.DevCreateReportXMLSource(ds, "HangTag_Set"); //return string.Empty; // generate xml file string result = DALBase.Helper.CreateReportFiles(ds, "HangTag_Set"); return(result); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; notification.DetailMessage.Add(ex.Message); if (ex.GetBaseException() != null) { notification.DetailMessage.Add(ex.GetBaseException().Message); } return(string.Empty); } }
public string ExportExcel(int userId, System.Collections.Hashtable filters, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; ReportDataObject ds = new ReportDataObject(); try { SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("WEXStockOverviewRpt_function_ExportProduct", new SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; if (filters.ContainsKey("ArticleCode") && !string.IsNullOrEmpty(filters["ArticleCode"].ToString())) { adap.SelectCommand.Parameters.AddWithValue("@ArticleCode", filters["ArticleCode"].ToString().Replace("'", "''")); } if (filters.ContainsKey("SubEANCode") && !string.IsNullOrEmpty(filters["SubEANCode"].ToString())) { adap.SelectCommand.Parameters.AddWithValue("@SubEANCode", filters["SubEANCode"].ToString().Replace("'", "''")); } if (filters.ContainsKey("Description") && !string.IsNullOrEmpty(filters["Description"].ToString())) { adap.SelectCommand.Parameters.AddWithValue("@Description", filters["Description"].ToString().Replace("'", "''")); } if (filters.ContainsKey("ProductTypeNM") && !string.IsNullOrEmpty(filters["ProductTypeNM"].ToString())) { adap.SelectCommand.Parameters.AddWithValue("@ProductTypeNM", filters["ProductTypeNM"].ToString().Replace("'", "''")); } if (filters.ContainsKey("NoImage") && filters["NoImage"] != null && !string.IsNullOrEmpty(filters["NoImage"].ToString())) { adap.SelectCommand.Parameters.AddWithValue("@NoImage", filters["NoImage"].ToString().Replace("'", "''")); } adap.Fill(ds.WEXStockOverviewRpt_ExcelData_View); if (!fwFactory.HasSpecialPermission(userId, Module.Framework.ConstantIdentifier.SPECIAL_PERMISSION_WEX_VVP)) { foreach (ReportDataObject.WEXStockOverviewRpt_ExcelData_ViewRow mRow in ds.WEXStockOverviewRpt_ExcelData_View) { mRow.SetVVPPriceNull(); } } ds.AcceptChanges(); //// prepare cache image //foreach (ReportDataObject.WEXStockOverviewRpt_ProductSearchResult_ViewRow mRow in ds.WEXStockOverviewRpt_ProductSearchResult_View) //{ // try // { // fwFactory.CreateImageCache(mRow.ImageFile, 120, 120, false); // } // catch { } //} return(Library.Helper.CreateReportFileWithEPPlus(ds, "WEXStockOverview", new List <string>() { "WEXStockOverviewRpt_ExcelData_View" })); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }
// // CUSTOM FUNCTION // public string GetExcelReportData(int userId, int supplierId, string season, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; ReportDataObject ds = new ReportDataObject(); try { // check permission if (fwFactory.CheckSupplierPermission(userId, supplierId) == 0) { throw new Exception("Current user don't have access permission for the selected supplier data"); } SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("FactoryPaymentOverviewRpt_function_getDetailData", new SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@SupplierID", supplierId); adap.SelectCommand.Parameters.AddWithValue("@Season", season); adap.Fill(ds.FactoryPaymentOverviewRpt_function_getDetailData); adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("FactoryPaymentOverviewRpt_function_getInvoiceData", new SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@SupplierID", supplierId); adap.SelectCommand.Parameters.AddWithValue("@Season", season); adap.Fill(ds.FactoryPaymentOverviewRpt_function_getInvoiceData); adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("FactoryPaymentOverviewRpt_function_getTotalData", new SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@SupplierID", supplierId); adap.SelectCommand.Parameters.AddWithValue("@Season", season); adap.Fill(ds.FactoryPaymentOverviewRpt_function_getTotalData); adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("FactoryPaymentOverviewRpt_function_getTotalExtraData", new SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@SupplierID", supplierId); adap.SelectCommand.Parameters.AddWithValue("@Season", season); adap.Fill(ds.FactoryPaymentOverviewRpt_function_getTotalExtraData); ReportDataObject.ReportHeaderRow row = ds.ReportHeader.NewReportHeaderRow(); row.Season = season; Support.DTO.Supplier dtoSupplier = supportFactory.GetSupplier(userId).FirstOrDefault(o => o.SupplierID == supplierId); if (dtoSupplier != null) { row.SupplierUD = dtoSupplier.SupplierUD; row.SupplierNM = dtoSupplier.SupplierNM; } ds.ReportHeader.AddReportHeaderRow(row); ds.AcceptChanges(); // dev //Library.Helper.DevCreateReportXMLSource(ds, "FactoryPaymentOverview"); //return string.Empty; // generate xml file return(Library.Helper.CreateCOMReportFile(ds, "FactoryPaymentOverview")); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }
public string GetStockListReport(Hashtable filters, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success, Message = "Get report success" }; try { string articleCode = string.Empty; string description = string.Empty; string productStatusIDs = string.Empty; string wareHouseAreaIDs = string.Empty; bool isIncludeImage = false; if (filters.ContainsKey("articleCode")) { articleCode = filters["articleCode"].ToString(); } if (filters.ContainsKey("description")) { description = filters["description"].ToString(); } if (filters.ContainsKey("productStatusIDs")) { productStatusIDs = filters["productStatusIDs"].ToString(); } if (filters.ContainsKey("wareHouseAreaIDs")) { wareHouseAreaIDs = filters["wareHouseAreaIDs"].ToString(); } if (filters.ContainsKey("isIncludeImage") && filters["isIncludeImage"] != null) { isIncludeImage = Convert.ToBoolean(filters["isIncludeImage"]); } ReportDataObject ds = new ReportDataObject(); SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("ReportMng_action_GetStockList", new SqlConnection(DALBase.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@ArticleCode", articleCode); adap.SelectCommand.Parameters.AddWithValue("@Description", description); adap.SelectCommand.Parameters.AddWithValue("@ProductStatusIDs", productStatusIDs); adap.SelectCommand.Parameters.AddWithValue("@WareHouseAreaIDs", wareHouseAreaIDs); adap.TableMappings.Add("Table", "ReportMng_StockList_View"); adap.TableMappings.Add("Table1", "ReportMng_StockList_PhysicalStockByWarehouseArea_View"); adap.TableMappings.Add("Table2", "ReportMng_StockList_ProductSetEANCode_View"); adap.Fill(ds); ds.AcceptChanges(); //create param table ReportDataObject.ParamTableRow pRow = ds.ParamTable.NewParamTableRow(); pRow.IsIncludeImage = isIncludeImage; ds.ParamTable.AddParamTableRow(pRow); //dev //DALBase.Helper.DevCreateReportXMLSource(ds, "StockList"); //return string.Empty; //assign location for every product foreach (var item in ds.ReportMng_StockList_View) { //assign area item.WarehouseAreaUD = ""; item.QntPerWarehouseArea = ""; foreach (var sItem in ds.ReportMng_StockList_PhysicalStockByWarehouseArea_View.Where(o => o.KeyID == item.KeyID)) { item.WarehouseAreaUD += sItem.WarehouseAreaUD + " / "; item.QntPerWarehouseArea += sItem.PhysicalQnt.ToString() + " / "; } if (item.WarehouseAreaUD.Length > 2) { item.WarehouseAreaUD = item.WarehouseAreaUD.Substring(0, item.WarehouseAreaUD.Length - 2); } if (item.QntPerWarehouseArea.Length > 2) { item.QntPerWarehouseArea = item.QntPerWarehouseArea.Substring(0, item.QntPerWarehouseArea.Length - 2); } //asign image if (isIncludeImage && System.IO.File.Exists(FrameworkSetting.Setting.AbsoluteThumbnailFolder + item.SelectedThumbnailImage)) { item.SelectedThumbnailImage = FrameworkSetting.Setting.ThumbnailUrl + item.SelectedThumbnailImage; } else { item.SelectedThumbnailImage = "NONE"; } //assign EAN Code item.EANCode = ""; foreach (var eItem in ds.ReportMng_StockList_ProductSetEANCode_View.Where(o => o.ProductID == item.GoodsID && item.ProductType == "PRODUCT")) { item.EANCode += eItem.EANCode + " / "; } if (item.EANCode.Length > 2) { item.EANCode = item.EANCode.Substring(0, item.EANCode.Length - 2); } } // generate xml file string result = DALBase.Helper.CreateReportFiles(ds, "StockList"); return(result); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; notification.DetailMessage.Add(ex.Message); if (ex.GetBaseException() != null) { notification.DetailMessage.Add(ex.GetBaseException().Message); } return(string.Empty); } }
public string GetExcelReportData(int SampleOrderID, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; ReportDataObject ds = new ReportDataObject(); try { SqlDataAdapter adap = new SqlDataAdapter(); adap.SelectCommand = new SqlCommand("SampleOrderOverviewRpt_function_GetPrintData", new SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@SampleOrderID", SampleOrderID); adap.TableMappings.Add("Table", "SampleOrderOverviewRpt_ReportData_View"); adap.TableMappings.Add("Table1", "SampleOrderOverviewRpt_ReportMinuteData_View"); adap.TableMappings.Add("Table2", "SampleOrderOverviewRpt_ReportRemarkData_View"); adap.TableMappings.Add("Table3", "SampleOrderOverviewRpt_ReportSampleOrder_View"); adap.TableMappings.Add("Table4", "SampleOrderOverviewRpt_ReportQARemarkData_View"); adap.Fill(ds); ReportDataObject.ReportHeaderRow hRow = ds.ReportHeader.NewReportHeaderRow(); hRow.Season = ""; if (ds.SampleOrderOverviewRpt_ReportData_View.FirstOrDefault() != null) { hRow.Season = ds.SampleOrderOverviewRpt_ReportData_View.FirstOrDefault().Season; } ds.ReportHeader.AddReportHeaderRow(hRow); // processing data and cleanup int sampleProductID = -1; string bigRemark = string.Empty; foreach (DAL.ReportDataObject.SampleOrderOverviewRpt_ReportData_ViewRow row in ds.SampleOrderOverviewRpt_ReportData_View) { sampleProductID = row.SampleProductID; bigRemark = string.Empty; foreach (DAL.ReportDataObject.SampleOrderOverviewRpt_ReportQARemarkData_ViewRow mRow in ds.SampleOrderOverviewRpt_ReportQARemarkData_View.Where(o => o.SampleProductID == sampleProductID)) { bigRemark += mRow.IndexNumber.ToString() + ". " + mRow.UpdatorName + "(" + mRow.DisplayUpdatedDate + ")"; bigRemark += Environment.NewLine + mRow.Remark + Environment.NewLine + Environment.NewLine; } row.LastMinuteTableRemark = bigRemark; bigRemark = string.Empty; foreach (DAL.ReportDataObject.SampleOrderOverviewRpt_ReportRemarkData_ViewRow rRow in ds.SampleOrderOverviewRpt_ReportRemarkData_View.Where(o => o.SampleProductID == sampleProductID)) { bigRemark += rRow.IndexNumber.ToString() + ". " + rRow.UpdatorName + "(" + rRow.DisplayUpdatedDate + ")"; bigRemark += Environment.NewLine + rRow.Remark + Environment.NewLine + Environment.NewLine; } row.InternRemark = bigRemark; } ds.Tables.Remove("SampleOrderOverviewRpt_ReportMinuteData_View"); ds.Tables.Remove("SampleOrderOverviewRpt_ReportRemarkData_View"); ds.Tables.Remove("SampleOrderOverviewRpt_ReportQARemarkData_View"); ds.AcceptChanges(); // generate xml file return(Library.Helper.CreateReportFileWithEPPlus(ds, "SampleOrderOverview", new List <string>() { "SampleOrderOverviewRpt_ReportData_View", "SampleOrderOverviewRpt_ReportSampleOrder_View", "ReportHeader" })); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }
public string ExportExcel(int userID, System.Collections.Hashtable filters, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; ReportDataObject ds = new ReportDataObject(); string clientUD = (filters.ContainsKey("clientUD") && filters["clientUD"] != null) ? filters["clientUD"].ToString() : null; string productionItemUD = (filters.ContainsKey("productionItemUD") && filters["productionItemUD"] != null) ? filters["productionItemUD"].ToString() : null; string productionItemNM = (filters.ContainsKey("productionItemNM") && filters["productionItemNM"] != null) ? filters["productionItemNM"].ToString() : null; string factoryUD = (filters.ContainsKey("factoryUD") && filters["factoryUD"] != null) ? filters["factoryUD"].ToString() : null; string factoryWarehouses = (filters.ContainsKey("listFactoryWarehouse") && filters["listFactoryWarehouse"] != null) ? filters["listFactoryWarehouse"].ToString() : null; string season = (filters.ContainsKey("season") && filters["season"] != null) ? filters["season"].ToString() : null; string factoryWarehousePalletUD = (filters.ContainsKey("factoryWarehousePalletUD") && filters["factoryWarehousePalletUD"] != null) ? filters["factoryWarehousePalletUD"].ToString() : null; int? companyID = fwFactory.GetCompanyID(userID); try { if (companyID.HasValue) { if (companyID.Value == 3 || companyID.Value == 4) { // Nothing } if (companyID.Value == 1) { if (string.IsNullOrEmpty(factoryWarehouses)) { factoryWarehouses = "39,41"; // SPOGA WAREHOUSE } } System.Data.SqlClient.SqlDataAdapter adap = new System.Data.SqlClient.SqlDataAdapter(); adap.SelectCommand = new System.Data.SqlClient.SqlCommand("ShowroomRpt_function_ExportShowroom", new System.Data.SqlClient.SqlConnection(Library.Helper.GetSQLConnectionString())); adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("@UserID", userID); adap.SelectCommand.Parameters.AddWithValue("@CompanyID", companyID); adap.SelectCommand.Parameters.AddWithValue("@ClientUD", clientUD); adap.SelectCommand.Parameters.AddWithValue("@ProductionItemUD", productionItemUD); adap.SelectCommand.Parameters.AddWithValue("@ProductionItemNM", productionItemNM); adap.SelectCommand.Parameters.AddWithValue("@FactoryUD", factoryUD); adap.SelectCommand.Parameters.AddWithValue("@FactoryWarehouses", factoryWarehouses); adap.SelectCommand.Parameters.AddWithValue("@FactoryWarehousePalletUD", factoryWarehousePalletUD); adap.SelectCommand.Parameters.AddWithValue("@Season", season); adap.SelectCommand.Parameters.AddWithValue("@SortedBy", String.Empty); adap.SelectCommand.Parameters.AddWithValue("@SortedDirection", String.Empty); adap.TableMappings.Add("Table", "ShowroomRpt_Showroom2_View"); adap.TableMappings.Add("Table1", "ShowroomRpt_ReceivingNote_View"); adap.TableMappings.Add("Table2", "ShowroomRpt_FactoryWarehousePallet_View"); adap.Fill(ds); ds.AcceptChanges(); return(Library.Helper.CreateReportFileWithEPPlus(ds, "ShowroomRpt")); } return(""); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }