protected void Page_Load(object sender, EventArgs e) { parseParameters(); _userId = (Guid)Membership.GetUser().ProviderUserKey; _db = Global.GetDbConnection(); //Load the report _report = _db.ORManager.Get <CustomReport>(_customReportId); //Set the URL for the preview link initPreviewLink(); lstReportParts.SelectedIndexChanged += lstReportParts_SelectedIndexChanged; ddlReportType.SelectedIndexChanged += ddlReportType_SelectedIndexChanged; cmdAdd.Click += cmdAdd_Click; cmdDelete.Click += cmdDelete_Click; cmdSave.Click += cmdSave_Click; //Verify that the report belongs to this user if (_report.UserId != _userId) { throw new ApplicationException("Report does not belong to the logged in user - Security violation"); } if (!Page.IsPostBack) { populateReportPartList(); //Confirm deletes JavaScriptBlock.ConfirmClick(cmdDelete, "Are you sure you want to delete the selected report part from this report?"); } }
//protected void lnkNewReport_Click(object sender, EventArgs e) //{ // Response.Redirect("frmReportCustomNew.aspx", true); //} protected void btnExportReport_Click(object sender, EventArgs e) { if (this.ddTitle.SelectedValue.ToString() != "") { DataSet dsExistingReport; IReports CustomReport; CustomReport = (IReports)ObjectFactory.CreateInstance("BusinessProcess.Reports.BReports,BusinessProcess.Reports"); dsExistingReport = CustomReport.GetCustomReportData(Convert.ToInt32(this.ddTitle.SelectedValue)); Stream stream = new MemoryStream(); dsExistingReport.WriteXml(stream, XmlWriteMode.WriteSchema); byte[] Buffer; Buffer = new byte[stream.Length]; stream.Position = 0; stream.Read(Buffer, 0, (int)stream.Length); stream.Close(); Response.Clear(); Response.ContentType = "application/xml"; Response.AddHeader("content-disposition", "attachment; filename=Report.xml"); Response.BinaryWrite(Buffer); Response.End(); } }
public virtual CustomReport UpdateCustomReport(CustomReport entity) { if (entity.IsTransient()) { return(entity); } CustomReport other = GetCustomReport(entity.CustomReportId); if (entity.Equals(other)) { return(entity); } string sql = @"Update CustomReport set [CustomReportGUID]=@CustomReportGUID , [Name]=@Name , [Description]=@Description , [SQLCommand]=@SQLCommand , [CreatedOn]=@CreatedOn where CustomReportID=@CustomReportID" ; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@CustomReportID", entity.CustomReportId) , new SqlParameter("@CustomReportGUID", entity.CustomReportGuid) , new SqlParameter("@Name", entity.Name) , new SqlParameter("@Description", entity.Description ?? (object)DBNull.Value) , new SqlParameter("@SQLCommand", entity.SqlCommand ?? (object)DBNull.Value) , new SqlParameter("@CreatedOn", entity.CreatedOn) }; SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray); return(GetCustomReport(entity.CustomReportId)); }
protected override void RunCycle() { int?reportId = _db.GetNextCustomReportId(); while (reportId != null) { try { _log.DebugFormat("{0}: Next custom report to send is {1}.", _name, reportId); SendReport((int)reportId); } catch (Exception ex) { _log.Error(string.Format("{0}: Error sending report {1}.", _name, reportId), ex); CustomReport report = _db.ORManager.Get <CustomReport>(reportId); if (report.LastEmailed != null) { _log.DebugFormat("{0}: Resetting custom report {1} so it is processed again next service cycle.", _name, reportId); // Reset the failed report so that it runs next time the engine runs // Add _cycleInterval so that it this report does not get run until the next service cycle report.LastEmailed = ((DateTime)report.LastEmailed).AddDays(-report.EmailIntervalDays).AddMilliseconds(_cycleInterval); _db.ORManager.SaveOrUpdate(report); } } reportId = _db.GetNextCustomReportId(); } _log.DebugFormat("{0}: No more custom reports to process.", _name); }
void buttonTestDocumentMasterCreatePDF_Clicked(object sender, EventArgs e) { Guid guidOid = new Guid("099EF525-FCEC-48D8-9EE8-FA0F34A34ED4"); FIN_DocumentFinanceMaster documentFinanceMaster = (FIN_DocumentFinanceMaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_DocumentFinanceMaster), guidOid); string fileName = CustomReport.DocumentMasterCreatePDF(documentFinanceMaster); _log.Debug(string.Format("fileName: [{0}]", fileName)); }
public InvoiceSubscription(PartnerInvDetails partnerInvDetails) : base(null, false) { InitializeComponent(); var customerReport = new CustomReport(partnerInvDetails); CreateDocument(customerReport); }
public static string DocumentMasterCreatePDF() { fin_documentfinancemaster documentFinanceMaster = TestProcessFinanceDocument.PersistFinanceDocument(SettingsApp.XpoOidDocumentFinanceTypeInvoice); string fileName = CustomReport.DocumentMasterCreatePDF(documentFinanceMaster); Console.WriteLine(string.Format("fileName: [{0}]", fileName)); return(fileName); }
protected void Page_Load(object sender, EventArgs e) { Session["PatientId"] = 0; //(Master.FindControl("lblRoot") as Label).Text = "Reports >>"; ////(Master.FindControl("lblMark") as Label).Text = "»"; //(Master.FindControl("lblMark") as Label).Visible = false; //(Master.FindControl("lblheader") as Label).Text = "Custom Reports"; //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Text = "Reports >> "; //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = "Custom Reports"; IQWebUtils Utils = new IQWebUtils(); Utils.HidePatientLevelheader(); this.btnExportReport.Attributes.Add("onclick", "javascript:return CheckReport('" + this.ddTitle.ClientID + "')"); this.btnRun.Attributes.Add("onclick", "javascript:return CheckReport('" + this.ddTitle.ClientID + "')"); this.btnEdit.Attributes.Add("onclick", "javascript:return CheckReport('" + this.ddTitle.ClientID + "')"); IQCareMsgBox.ShowConfirm("CustomRepRefresh", btnRefresh); //RTyagi..20-Feb-07. if (Page.IsPostBack != true) { AuthenticationManager Authentiaction = new AuthenticationManager(); if (Authentiaction.HasFunctionRight(ApplicationAccess.CustomReports, FunctionAccess.View, (DataTable)Session["UserRight"]) == false) { btnEdit.Enabled = false; btnRun.Enabled = false; btnExportReport.Enabled = false; btnEditImport.Enabled = false; } //Thread theRptTable = new Thread(RefreshReportingTables); //theRptTable.Priority = ThreadPriority.Highest; //theRptTable.Start(); DataSet dsCategory; IReports CustomReport; CustomReport = (IReports)ObjectFactory.CreateInstance("BusinessProcess.Reports.BReports,BusinessProcess.Reports"); dsCategory = CustomReport.GetAllCategory(); BindFunctions theBind = new BindFunctions(); theBind.BindCombo(ddCategory, dsCategory.Tables[0], "CategoryName", "CategoryId"); //ddCategory.Items.Insert(0, new ListItem("Select Category", "")); ddTitle.Items.Insert(0, new ListItem("Select Title", "")); ////// string str = string.Empty; if (Request.QueryString["r"] != null) { str = Request.QueryString["r"].ToString(); } if (str != "no") { string thescript = "<script language = 'javascript' defer ='defer' id = 'refreshCache'>\n"; thescript += "document.getElementById('" + btnRefresh.ClientID + "').click();\n"; thescript += "</script>\n"; RegisterStartupScript("refreshCache", thescript); } //return; } }
private void CreateDocument(CustomReport report) { Previewwin.DocumentSource = report; if (!string.IsNullOrEmpty(session.User._Printer)) { report.PrinterName = session.User._Printer; } report.CreateDocument(true); }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: public static bool PrintFinanceDocument(SYS_ConfigurationPrinters pPrinter, FIN_DocumentFinanceMaster pDocumentFinanceMaster, List <int> pCopyNames, bool pSecondCopy, string pMotive) { bool result = false; if (pPrinter != null) { //Init Helper Vars bool resultSystemPrint = false; int printCopies = pCopyNames.Count; //Get Hash4Chars from Hash string hash4Chars = ProcessFinanceDocument.GenDocumentHash4Chars(pDocumentFinanceMaster.Hash); try { switch (GetPrinterToken(pPrinter.PrinterType.Token)) { //Impressora SINOCAN em ambiente Windows case "THERMAL_PRINTER_WINDOWS": //Impressora SINOCAN em ambiente Linux case "THERMAL_PRINTER_LINUX": //Impressora SINOCAN em ambiente WindowsLinux/Socket case "THERMAL_PRINTER_SOCKET": //Impressora SINOCAN em ambiente WindowsLinux/USB case "THERMAL_PRINTER_USB": ThermalPrinterFinanceDocumentMaster thermalPrinterFinanceDocument = new ThermalPrinterFinanceDocumentMaster(pPrinter, pDocumentFinanceMaster, pCopyNames, pSecondCopy, pMotive); thermalPrinterFinanceDocument.Print(); //Add to SystemPrint Audit resultSystemPrint = SystemPrintInsert(pDocumentFinanceMaster, pPrinter.Designation, printCopies, pCopyNames, pSecondCopy, pMotive); break; case "GENERIC_PRINTER_WINDOWS": CustomReport.ProcessReportFinanceDocument(CustomReportDisplayMode.Print, pDocumentFinanceMaster.Oid, hash4Chars, pCopyNames, pSecondCopy, pMotive); //Add to SystemPrint Audit resultSystemPrint = SystemPrintInsert(pDocumentFinanceMaster, pPrinter.Designation, printCopies, pCopyNames, pSecondCopy, pMotive); break; case "REPORT_EXPORT_PDF": CustomReport.ProcessReportFinanceDocument(CustomReportDisplayMode.ExportPDF, pDocumentFinanceMaster.Oid, hash4Chars, pCopyNames, pSecondCopy, pMotive); //Add to SystemPrint Audit : Developer : Use here Only to Test SystemPrintInsert resultSystemPrint = SystemPrintInsert(pDocumentFinanceMaster, pPrinter.Designation, printCopies, pCopyNames, pSecondCopy, pMotive); break; } result = true; } catch (Exception ex) { _log.Warn(ex.Message, ex); throw new Exception(ex.Message); } } return(result); }
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: public static bool PrintFinanceDocumentPayment(SYS_ConfigurationPrinters pPrinter, FIN_DocumentFinancePayment pDocumentFinancePayment) { bool result = false; if (pPrinter != null) { //Init Helper Vars bool resultSystemPrint = false; //Initialize CopyNames List from PrintCopies List <int> copyNames = CustomReport.CopyNames(pDocumentFinancePayment.DocumentType.PrintCopies); int printCopies = copyNames.Count; try { switch (GetPrinterToken(pPrinter.PrinterType.Token)) { //Impressora SINOCAN em ambiente Windows case "THERMAL_PRINTER_WINDOWS": //Impressora SINOCAN em ambiente Linux case "THERMAL_PRINTER_LINUX": //Impressora SINOCAN em ambiente WindowsLinux/Socket case "THERMAL_PRINTER_SOCKET": //Impressora SINOCAN em ambiente WindowsLinux/USB case "THERMAL_PRINTER_USB": ThermalPrinterFinanceDocumentPayment thermalPrinterFinanceDocumentPayment = new ThermalPrinterFinanceDocumentPayment(pPrinter, pDocumentFinancePayment, copyNames, false); thermalPrinterFinanceDocumentPayment.Print(); //Add to SystemPrint Audit resultSystemPrint = SystemPrintInsert(pDocumentFinancePayment, pPrinter.Designation, printCopies, copyNames); break; case "GENERIC_PRINTER_WINDOWS": CustomReport.ProcessReportFinanceDocumentPayment(CustomReportDisplayMode.Print, pDocumentFinancePayment.Oid, copyNames); //Add to SystemPrint Audit resultSystemPrint = SystemPrintInsert(pDocumentFinancePayment, pPrinter.Designation, printCopies, copyNames); break; case "REPORT_EXPORT_PDF": CustomReport.ProcessReportFinanceDocumentPayment(CustomReportDisplayMode.ExportPDF, pDocumentFinancePayment.Oid, copyNames); //Add to SystemPrint Audit : Developer : Use here Only to Test SystemPrintInsert resultSystemPrint = SystemPrintInsert(pDocumentFinancePayment, pPrinter.Designation, printCopies, copyNames); break; } result = true; } catch (Exception ex) { _log.Warn(ex.Message, ex); throw new Exception(ex.Message); } } return(result); }
private void cmdAdd_Click(object sender, EventArgs e) { CustomReport newRpt; newRpt = new CustomReport(); newRpt.Name = "Untitled Custom Report"; newRpt.Description = string.Empty; newRpt.EmailIntervalDays = 0; newRpt.UserId = _userId; _db.ORManager.SaveOrUpdate(newRpt); lstReports.Items.Add(new ListItem(newRpt.Name, newRpt.Id.ToString())); }
public ThermalPrinterBaseFinanceTemplate(SYS_ConfigurationPrinters pPrinter, FIN_DocumentFinanceType pDocumentType, List <int> pCopyNames, bool pSecondCopy) : base(pPrinter, SettingsApp.PrinterThermalImageCompanyLogo) { //Assign Parameter Properties _documentType = pDocumentType; _copyNames = pCopyNames; _secondCopy = pSecondCopy; //Generate CopyNamesArray (Original, Duplicate,...) if (_copyNames != null) { _copyNamesArray = CustomReport.CopyNames(pCopyNames); } }
public virtual CustomReport CustomReportFromDataRow(DataRow dr) { if (dr == null) { return(null); } CustomReport entity = new CustomReport(); entity.CustomReportId = (System.Int32)dr["CustomReportID"]; entity.CustomReportGuid = (System.Guid)dr["CustomReportGUID"]; entity.Name = dr["Name"].ToString(); entity.Description = dr["Description"].ToString(); entity.SqlCommand = dr["SQLCommand"].ToString(); entity.CreatedOn = (System.DateTime)dr["CreatedOn"]; return(entity); }
/// <summary> /// 是否已报备 /// </summary> /// <param name="cr"></param> /// <returns></returns> private bool HasCustom(CustomReport cr) { var t = new CustomReport(); Type type = t.GetType(); bool hasCustom = true; foreach (var property in type.GetProperties()) { if (property.GetValue(cr, null) == null) { hasCustom = false; break; } } return(hasCustom); }
private void displayReportDetails(CustomReport rpt) { if (rpt == null) { txtName.Enabled = false; txtName.Text = ""; txtDescription.Enabled = false; txtDescription.Text = ""; ddlEmailInterval.Enabled = false; ddlEmailInterval.SelectedIndex = 0; cmdSave.Enabled = false; blReportcomponents.Items.Clear(); lnkPreview.Visible = false; } else { txtName.Enabled = true; txtName.Text = rpt.Name; txtDescription.Enabled = true; txtDescription.Text = rpt.Description; ddlEmailInterval.Enabled = true; ddlEmailInterval.SelectedValue = rpt.EmailIntervalDays.ToString(); cmdSave.Enabled = true; blReportcomponents.Items.Clear(); //Populate the report component list foreach (CustomReportComponent currComponent in rpt.ReportComponents) { blReportcomponents.Items.Add(currComponent.ComponentType.Name); } if (blReportcomponents.Items.Count > 0) { lnkPreview.Visible = true; initPreviewLink(rpt.Id.Value); } else { lnkPreview.Visible = false; } lnkEditReportComponents.NavigateUrl = string.Format("~/Members/Reports/Custom-Reports/Report-Component-Editor.aspx?Custom-Report-Id={0}", rpt.Id); } }
// Test Document Report void TestDocumentReport() { Guid docOid = new Guid("6d44b0a8-6450-4245-b4ee-a6e971f4bcec"); FIN_DocumentFinanceMaster documentFinanceMaster = (FIN_DocumentFinanceMaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_DocumentFinanceMaster), docOid); if (documentFinanceMaster != null) { //Generate Default CopyNames from DocumentType List <int> copyNames = CustomReport.CopyNames(documentFinanceMaster.DocumentType.PrintCopies); string hash4Chars = ProcessFinanceDocument.GenDocumentHash4Chars(documentFinanceMaster.Hash); string destinationFileName = ""; string result = CustomReport.ProcessReportFinanceDocument(CustomReportDisplayMode.Design, documentFinanceMaster.Oid, hash4Chars, copyNames, destinationFileName); _log.Debug(String.Format("Result: [{0}]", result)); } else { _log.Debug(String.Format("Null Document Found for documentType: [{0}]", nameof(FIN_DocumentFinanceMaster), docOid.ToString())); } }
private void loadParameters() { string reportIdParameter; int reportId; reportIdParameter = Request.QueryString[PARAM_REPORT_ID]; if (string.IsNullOrEmpty(reportIdParameter)) { throw new ApplicationException(PARAM_REPORT_ID + " is a required parameter, but was not supplied"); } reportId = int.Parse(reportIdParameter); _report = _db.ORManager.Get <CustomReport>(reportId); if (_report.UserId != _userId) { throw new Exception("A non-report owner attempted to access report #" + reportId); } }
protected void ddCategory_SelectedIndexChanged(object sender, EventArgs e) { if (ddCategory.SelectedIndex == 0) { ddTitle.Items.Clear(); ddTitle.Items.Insert(0, new ListItem("Select Title", "")); } else if ((ddCategory.SelectedValue != "") && (ddCategory.SelectedIndex != 0)) { DataSet dsReports; IReports CustomReport; CustomReport = (IReports)ObjectFactory.CreateInstance("BusinessProcess.Reports.BReports,BusinessProcess.Reports"); dsReports = CustomReport.GetReportList(Convert.ToInt32(ddCategory.SelectedValue)); ddTitle.DataSource = dsReports.Tables[0]; ddTitle.DataTextField = "ReportName"; ddTitle.DataValueField = "ReportId"; ddTitle.DataBind(); ddTitle.Items.Insert(0, new ListItem("Select Title", "")); } }
public virtual CustomReport InsertCustomReport(CustomReport entity) { CustomReport other = new CustomReport(); other = entity; if (entity.IsTransient()) { string sql = @"Insert into CustomReport ( [CustomReportGUID] ,[Name] ,[Description] ,[SQLCommand] ,[CreatedOn] ) Values ( @CustomReportGUID , @Name , @Description , @SQLCommand , @CreatedOn ); Select scope_identity()" ; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@CustomReportID", entity.CustomReportId) , new SqlParameter("@CustomReportGUID", entity.CustomReportGuid) , new SqlParameter("@Name", entity.Name) , new SqlParameter("@Description", entity.Description ?? (object)DBNull.Value) , new SqlParameter("@SQLCommand", entity.SqlCommand ?? (object)DBNull.Value) , new SqlParameter("@CreatedOn", entity.CreatedOn) }; var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray); if (identity == DBNull.Value) { throw new DataException("Identity column was null as a result of the insert operation."); } return(GetCustomReport(Convert.ToInt32(identity))); } return(entity); }
public virtual void SendReport(int id) { ReportPartGenerator rpg = new ReportPartGenerator(_db); EmailMessage email = new EmailMessage(_customReportTemplate); StringBuilder htmlBuilder = new StringBuilder(); Dictionary <string, MemoryStream> imageStreams = new Dictionary <string, MemoryStream>(); int imgCounter = 0; CustomReport report = _db.ORManager.Get <CustomReport>(id); // Prepare the EmailMessage email.From = "*****@*****.**"; // Placeholder - will be replaced by email engine email.ReplaceGeneralTokens(); email.ApplyToUser(Membership.GetUser(report.UserId), _db.ORManager.Get <UserInformation>(report.UserId)); email.ReplaceInMessage(TOKEN_REPORT_TITLE, report.Name); // Fetch the custom report components ICriteria componentCriteria = _db.ORManager.Session.CreateCriteria(typeof(CustomReportComponent)).Add(Expression.Eq("CustomReport.Id", id)); IList <CustomReportComponent> components = componentCriteria.List <CustomReportComponent>(); htmlBuilder.Append("<table class=\"ReportComponentsTable\">"); // Add each custom report component to the custom report foreach (CustomReportComponent component in components) { GeneratedReportPart grp = rpg.GenerateReport(component); if (grp.Bytes != null) { // Create a placeholder for the embedded image string cid = string.Format("{0}{1}", CID_REPORT_IMAGE, imgCounter++); // Create an embedded image tag htmlBuilder.AppendFormat("<tr><td><img src=cid:{0}><br /></td></tr>", cid); // Generate and save the memory stream for this embeded image MemoryStream ms = new MemoryStream(grp.Bytes); imageStreams.Add(cid, ms); } else { // Append the raw HTML htmlBuilder.AppendFormat("<tr><td>{0}</td></tr>", grp.Html); } } htmlBuilder.Append("</table>"); // Insert report components into email message email.ReplaceInMessage(TOKEN_REPORT_CONTENT, htmlBuilder.ToString()); MailMessage msg = email.GetMailMessage(); // Create Text-Only AlternateView AlternateView plainView = AlternateView.CreateAlternateViewFromString("Your email client does not appear to support viewing HTML emails. Your email client must support this in order to view this email.", Encoding.Default, "text/plain"); msg.AlternateViews.Add(plainView); // Prepare new AlternateView and clear the message body AlternateView htmlView = AlternateView.CreateAlternateViewFromString(msg.Body, Encoding.Default, MediaTypeNames.Text.Html); htmlView.TransferEncoding = TransferEncoding.SevenBit; msg.AlternateViews.Add(htmlView); msg.Body = null; // Embed Logo EmbedGifImage(htmlView, GetEmbeddedImage("RankTrend-Logo.gif"), "EmbeddedLogo"); // Embed the images foreach (string key in imageStreams.Keys) { EmbedPngImage(htmlView, imageStreams[key], key); } // Send the email RtEngines.EmailEngine.SendEmail(msg, true); }
/// <summary> /// Get Accordion Definition and Generate Privileges (Output to Console) /// </summary> /// <returns></returns> private Dictionary <string, AccordionNode> GetAccordionDefinition() { //Init accordionDefinition Dictionary <string, AccordionNode> accordionDefinition = null; try { string buttonLabelReportTypeString = string.Empty; string buttonLabel = string.Empty; string buttonLabelString = string.Empty; string buttonResourceString = string.Empty; string buttoLabelPostfix = string.Empty; string userpermissionitemToken = string.Empty; Guid userpermissionitemGuid = Guid.Empty; Guid userpermissionprofileGuid = Guid.Empty; List <string> userpermissionitemInsert = new List <string>(); List <string> userpermissionprofileInsert = new List <string>(); string templatePermissionItem = "INSERT INTO sys_userpermissionitem (Oid,Ord,Code,Token,Designation,PermissionGroup) VALUES ('{0}',{1},{1},'{2}','{3}','4c047b35-8fe5-4a4b-ac6e-59c87e0f760a');"; string userpermissionprofileItem = "INSERT INTO sys_userpermissionprofile (Oid,Granted,userprofile,PermissionItem) VALUES ('{0}',1,'1626e21f-75e6-429e-b0ac-edb755e733c2','{1}');"; // Init Accordion accordionDefinition = new Dictionary <string, AccordionNode>(); // ReportType : Collection CriteriaOperator criteriaOperator = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled <> 1)"); SortProperty[] sortProperty = new SortProperty[2]; sortProperty[0] = new SortProperty("Ord", SortingDirection.Ascending); sortProperty[1] = new SortProperty("Designation", SortingDirection.Ascending); XPCollection xpoCollection = new XPCollection(GlobalFramework.SessionXpo, typeof(RPT_ReportType), criteriaOperator, sortProperty); // Report : Collection (ReportType Property Navigations) SortingCollection sortingCollection = new SortingCollection(); sortingCollection.Add(new SortProperty("Ord", SortingDirection.Ascending)); foreach (RPT_ReportType reportType in xpoCollection) { // Init AccordionChild Dictionary <string, AccordionNode> accordionChilds = new Dictionary <string, AccordionNode>(); buttonLabelReportTypeString = Resx.ResourceManager.GetString(reportType.ResourceString); // Try to get Resource if (string.IsNullOrEmpty(buttonLabelReportTypeString)) { // Log Before Exchange _ with - to show in button labels _log.Error(string.Format("Can't find resourceString: [{0}]", reportType.ResourceString)); buttonLabelReportTypeString = string.Format("${0}$", reportType.ResourceString.Replace("_", "-")); } // Apply Sorting to childs of ReportType reportType.Report.Sorting = sortingCollection; // Loop ReportType Reports foreach (RPT_Report report in reportType.Report) { if (!report.Disabled) { // Generate Insert for userpermissionitem and userpermissionitem userpermissionitemToken = report.Token; userpermissionitemGuid = Guid.NewGuid(); userpermissionprofileGuid = Guid.NewGuid(); userpermissionitemInsert.Add(string.Format(templatePermissionItem, userpermissionitemGuid, _userpermissionitemOrdAndCode, userpermissionitemToken, report.Designation.Replace(" de ", " - "))); userpermissionprofileInsert.Add(string.Format(userpermissionprofileItem, userpermissionprofileGuid, userpermissionitemGuid)); _userpermissionitemOrdAndCode += 10; // Get common resource for all 3 types of Financial Reports Tuple <string, string> tuppleResourceString = CustomReport.GetResourceString(report.ResourceString); buttonLabelString = tuppleResourceString.Item1; buttoLabelPostfix = tuppleResourceString.Item2; // Try to get Resource if (string.IsNullOrEmpty(buttonLabelString)) { // Log Before Exchange _ with - to show in button labels buttonLabelString = report.ResourceString; _log.Debug(string.Format("Error Missing resourceString! {0}", buttonLabelString)); buttonLabelString = string.Format("${0}$", report.ResourceString.Replace("_", "-")); } // Used this for debug purposes, Add Code, usefull to identify Reports //buttonLabel = string.Format("[{0}] {1}{2}", report.Code, buttonResourceString, resourceStringPostfix); buttonLabel = string.Format("{0}{1}", buttonLabelString, buttoLabelPostfix); // Output Order and Labels //_log.Debug(String.Format("Label: [{0}]", buttonLabel)); // Add Child Menu accordionChilds.Add(userpermissionitemToken, new AccordionNode(buttonLabel) { Clicked = PrintReportRouter }); } } // Add Main Accordion Parent Buttons accordionDefinition.Add($"TopMenu{reportType.Code}", new AccordionNode(buttonLabelReportTypeString) { Childs = accordionChilds, GroupIcon = new Image($"Assets/Images/Icons/Reports/{reportType.MenuIcon}") }); } // Output Inserts if (_showInsertLog) { _log.Debug("Generated Inserts"); for (int i = 0; i < userpermissionitemInsert.Count; i++) { _log.Debug(userpermissionitemInsert[i]); } for (int i = 0; i < userpermissionprofileInsert.Count; i++) { _log.Debug(userpermissionprofileInsert[i]); } } } catch (Exception ex) { _log.Error(ex.Message, ex); } return(accordionDefinition); }
private void PrintReportRouter(object sender, EventArgs e) { CustomReportDisplayMode displayMode = (Debugger.IsAttached) ? CustomReportDisplayMode.Design : CustomReportDisplayMode.ExportPDF; // Override Default Development Mode displayMode = CustomReportDisplayMode.ExportPDF; // Local Variables string reportFilter = string.Empty; string reportFilterHumanReadable = string.Empty; string databaseSourceObject = string.Empty; AccordionChildButton button = (sender as AccordionChildButton); //_log.Debug(String.Format("Button.Name: [{0}], Button.label: [{1}]", button.Name, button.Label)); // Get Token From buttonName ReportsTypeToken token = (ReportsTypeToken)Enum.Parse(typeof(ReportsTypeToken), button.Name, true); // Prepare ReportsQueryDialogMode ReportsQueryDialogMode reportsQueryDialogMode = ReportsQueryDialogMode.UNDEFINED; // Catch REPORT_SALES_DETAIL_* and REPORT_SALES_DETAIL_GROUP_* use same View if (token.ToString().StartsWith("REPORT_SALES_DETAIL_")) { reportsQueryDialogMode = ReportsQueryDialogMode.FINANCIAL_DETAIL; databaseSourceObject = "view_documentfinance"; } else if (token.ToString().StartsWith("REPORT_SALES_")) { reportsQueryDialogMode = ReportsQueryDialogMode.FINANCIAL; databaseSourceObject = "fin_documentfinancemaster"; } else if (token.ToString().Equals("REPORT_LIST_STOCK_MOVEMENTS")) { reportsQueryDialogMode = ReportsQueryDialogMode.ARTICLE_STOCK_MOVEMENTS; databaseSourceObject = "view_articlestockmovement"; } else if (token.ToString().Equals("REPORT_LIST_AUDIT_TABLE")) { reportsQueryDialogMode = ReportsQueryDialogMode.SYSTEM_AUDIT; databaseSourceObject = "view_systemaudit"; } else if (token.ToString().Equals("REPORT_LIST_CURRENT_ACCOUNT")) { reportsQueryDialogMode = ReportsQueryDialogMode.CURRENT_ACCOUNT; databaseSourceObject = "view_documentfinancecurrentaccount"; } else if (token.ToString().Equals("REPORT_LIST_USER_COMMISSION")) { reportsQueryDialogMode = ReportsQueryDialogMode.USER_COMMISSION; databaseSourceObject = "view_usercommission"; } // Common GetReportsQueryDialogFilter for All Non Undefined ReportsQueryDialogMode if (reportsQueryDialogMode != ReportsQueryDialogMode.UNDEFINED) { // Call PosReportsQueryDialog to get Filter List <string> dialogresultFilter = GetReportsQueryDialogFilter(reportsQueryDialogMode, databaseSourceObject); if (dialogresultFilter != null && dialogresultFilter.Count == 2) { reportFilter = dialogresultFilter[0]; reportFilterHumanReadable = dialogresultFilter[1]; } // ResponseType.Cancel else { reportFilter = null; reportFilterHumanReadable = null; } } // Proceed if we have a Filter != null (ResponseType.Ok), ex can be a string.Empty //if (reportFilter != null || !financialViewMode) if (reportFilter != null /* || reportsQueryDialogMode != ReportsQueryDialogMode.UNDEFINED*/) { switch (token) { case ReportsTypeToken.REPORT_SALES_PER_FINANCE_DOCUMENT: CustomReport.ProcessReportDocumentMasterList(displayMode , Resx.ResourceManager.GetString(token.ToString().ToLower()) , "[DocumentFinanceMaster.DocumentType.Ord]" , "[DocumentFinanceMaster.DocumentType.Designation] ([DocumentFinanceMaster.DocumentType.Code])", reportFilter, reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_PER_DATE: CustomReport.ProcessReportDocumentMasterList(displayMode , Resx.ResourceManager.GetString(token.ToString().ToLower()) , "[DocumentFinanceMaster.DocumentDate]" , "[DocumentFinanceMaster.DocumentDate]", reportFilter, reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_PER_USER: CustomReport.ProcessReportDocumentMasterList(displayMode , Resx.ResourceManager.GetString(token.ToString().ToLower()) , "[DocumentFinanceMaster.CreatedBy.Ord]" , "[DocumentFinanceMaster.CreatedBy.Name] ([DocumentFinanceMaster.CreatedBy.Code])", reportFilter, reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_PER_TERMINAL: CustomReport.ProcessReportDocumentMasterList(displayMode , Resx.ResourceManager.GetString(token.ToString().ToLower()) , "[DocumentFinanceMaster.CreatedWhere.Ord]" , "[DocumentFinanceMaster.CreatedWhere.Designation] ([DocumentFinanceMaster.CreatedWhere.Code])", reportFilter, reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_PER_CUSTOMER: CustomReport.ProcessReportDocumentMasterList(displayMode , Resx.ResourceManager.GetString(token.ToString().ToLower()) , "[DocumentFinanceMaster.EntityFiscalNumber]" , "[DocumentFinanceMaster.EntityName] ([DocumentFinanceMaster.EntityFiscalNumber])", reportFilter, reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_PER_PAYMENT_METHOD: CustomReport.ProcessReportDocumentMasterList(displayMode , Resx.ResourceManager.GetString(token.ToString().ToLower()) , "[DocumentFinanceMaster.PaymentCondition.Ord]" , "[DocumentFinanceMaster.PaymentCondition.Designation] ([DocumentFinanceMaster.PaymentCondition.Code])", // Required to Exclude Documents without PaymentMethod else Errors Occur (string.IsNullOrEmpty(reportFilter)) ? "PaymentMethod IS NOT NULL" : string.Format("{0} AND PaymentMethod IS NOT NULL", reportFilter), reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_PER_PAYMENT_CONDITION: CustomReport.ProcessReportDocumentMasterList(displayMode , Resx.ResourceManager.GetString(token.ToString().ToLower()) , "[DocumentFinanceMaster.PaymentCondition.Ord]" , "[DocumentFinanceMaster.PaymentCondition.Designation] ([DocumentFinanceMaster.PaymentCondition.Code])", // Required to Exclude Documents without PaymentCondition else Errors Occur (string.IsNullOrEmpty(reportFilter)) ? "PaymentCondition IS NOT NULL" : string.Format("{0} AND PaymentCondition IS NOT NULL", reportFilter), reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_PER_CURRENCY: CustomReport.ProcessReportDocumentMasterList(displayMode , Resx.ResourceManager.GetString(token.ToString().ToLower()) , "[DocumentFinanceMaster.Currency.Ord]" , "[DocumentFinanceMaster.Currency.Designation] ([DocumentFinanceMaster.Currency.Code])", // Required to Exclude Documents without PaymentCondition else Errors Occur (string.IsNullOrEmpty(reportFilter)) ? "PaymentCondition IS NOT NULL" : string.Format("{0} AND PaymentCondition IS NOT NULL", reportFilter), reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_PER_COUNTRY: CustomReport.ProcessReportDocumentMasterList(displayMode , Resx.ResourceManager.GetString(token.ToString().ToLower()) , "[DocumentFinanceMaster.EntityCountry]" , "[DocumentFinanceMaster.EntityCountry]", reportFilter, reportFilterHumanReadable ); break; //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // Detail case ReportsTypeToken.REPORT_SALES_DETAIL_PER_FINANCE_DOCUMENT: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "[DocumentFinanceDetail.DocumentTypeOrd]" , "[DocumentFinanceDetail.DocumentTypeDesignation] ([DocumentFinanceDetail.DocumentTypeCode])", reportFilter, reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_PER_DATE: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "[DocumentFinanceDetail.DocumentDate]" , "[DocumentFinanceDetail.DocumentDate]", reportFilter, reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_PER_USER: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "[DocumentFinanceDetail.UserDetailOrd]" , "[DocumentFinanceDetail.UserDetailName] ([DocumentFinanceDetail.UserDetailCode])", reportFilter, reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_PER_TERMINAL: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "[DocumentFinanceDetail.TerminalOrd]" , "[DocumentFinanceDetail.TerminalDesignation] ([DocumentFinanceDetail.TerminalCode])", reportFilter, reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_PER_CUSTOMER: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "[DocumentFinanceDetail.EntityFiscalNumber]" , "[DocumentFinanceDetail.EntityName] ([DocumentFinanceDetail.EntityFiscalNumber])", reportFilter, reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_PER_PAYMENT_METHOD: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "[DocumentFinanceDetail.PaymentMethodOrd]" , "[DocumentFinanceDetail.PaymentMethodDesignation] ([DocumentFinanceDetail.PaymentMethodCode])", (string.IsNullOrEmpty(reportFilter)) ? "fmPaymentMethod IS NOT NULL" : string.Format("{0} AND fmPaymentMethod IS NOT NULL", reportFilter), reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_PER_PAYMENT_CONDITION: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "[DocumentFinanceDetail.PaymentConditionOrd]" , "[DocumentFinanceDetail.PaymentConditionDesignation] ([DocumentFinanceDetail.PaymentConditionCode])", (string.IsNullOrEmpty(reportFilter)) ? "fmPaymentCondition IS NOT NULL" : string.Format("{0} AND fmPaymentCondition IS NOT NULL", reportFilter), reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_PER_CURRENCY: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "[DocumentFinanceDetail.CurrencyOrd]" , "[DocumentFinanceDetail.CurrencyDesignation] ([DocumentFinanceDetail.CurrencyCode])", reportFilter, reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_PER_COUNTRY: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "[DocumentFinanceDetail.CountryOrd]" , "[DocumentFinanceDetail.CountryDesignation] ([DocumentFinanceDetail.EntityCountryCode2])", reportFilter, reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_PER_FAMILY: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "[DocumentFinanceDetail.ArticleFamilyOrd]" , "[DocumentFinanceDetail.ArticleFamilyDesignation] ([DocumentFinanceDetail.ArticleFamilyCode])", reportFilter, reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_PER_FAMILY_AND_SUBFAMILY: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "[DocumentFinanceDetail.ArticleSubFamilyOrd]" , "[DocumentFinanceDetail.ArticleFamilyDesignation] ([DocumentFinanceDetail.ArticleFamilyCode]) / [DocumentFinanceDetail.ArticleSubFamilyDesignation] ([DocumentFinanceDetail.ArticleSubFamilyCode])", reportFilter, reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_PER_PLACE: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "[DocumentFinanceDetail.PlaceOrd]" , "[DocumentFinanceDetail.PlaceDesignation] ([DocumentFinanceDetail.PlaceCode])", // Required to Exclude Documents without Place (string.IsNullOrEmpty(reportFilter)) ? "cpPlace IS NOT NULL" : string.Format("{0} AND cpPlace IS NOT NULL", reportFilter), reportFilterHumanReadable ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_PER_PLACE_TABLE: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "[DocumentFinanceDetail.PlaceTableOrd]" , "[DocumentFinanceDetail.PlaceDesignation] ([DocumentFinanceDetail.PlaceCode]) / [DocumentFinanceDetail.PlaceTableDesignation] ([DocumentFinanceDetail.PlaceTableCode])", // Required to Exclude Documents without PlaceTable (string.IsNullOrEmpty(reportFilter)) ? "dmPlaceTable IS NOT NULL" : string.Format("{0} AND dmPlaceTable IS NOT NULL", reportFilter), reportFilterHumanReadable ); break; //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // Detail/Group case ReportsTypeToken.REPORT_SALES_DETAIL_GROUP_PER_FINANCE_DOCUMENT: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "ftOid, ftDocumentTypeOrd, ftDocumentTypeCode, ftDocumentTypeDesignation" , "ftOid AS GroupOid, ftDocumentTypeOrd AS GroupOrd, ftDocumentTypeCode AS GroupCode, ftDocumentTypeDesignation AS GroupDesignation" , "[DocumentFinanceDetail.GroupOid]" , "[DocumentFinanceDetail.GroupDesignation] ([DocumentFinanceDetail.GroupCode])" , reportFilter , reportFilterHumanReadable , true ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_GROUP_PER_DATE: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "fmDocumentDate" , "fmDocumentDate AS GroupOid, fmDocumentDate AS GroupOrd, fmDocumentDate AS GroupCode, fmDocumentDate AS GroupDesignation" , "[DocumentFinanceDetail.GroupOid]" , "[DocumentFinanceDetail.GroupDesignation]" , reportFilter , reportFilterHumanReadable , true ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_GROUP_PER_USER: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "udUserDetail, udUserDetailOrd, udUserDetailCode, udUserDetailName" , "udUserDetail AS GroupOid, udUserDetailOrd AS GroupOrd, udUserDetailCode AS GroupCode, udUserDetailName AS GroupDesignation" , "[DocumentFinanceDetail.GroupOid]" , "[DocumentFinanceDetail.GroupDesignation] ([DocumentFinanceDetail.GroupCode])" , reportFilter , reportFilterHumanReadable , true , true ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_GROUP_PER_TERMINAL: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "trTerminal, trTerminalOrd, trTerminalCode, trTerminalDesignation" , "trTerminal AS GroupOid, trTerminalOrd AS GroupOrd, trTerminalCode AS GroupCode, trTerminalDesignation AS GroupDesignation" , "[DocumentFinanceDetail.GroupOid]" , "[DocumentFinanceDetail.GroupDesignation] ([DocumentFinanceDetail.GroupCode])" , reportFilter , reportFilterHumanReadable , true ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_GROUP_PER_CUSTOMER: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "fmEntity, cuEntityOrd, cuEntityCode, fmEntityName" , "fmEntity AS GroupOid, cuEntityOrd AS GroupOrd, cuEntityCode AS GroupCode, fmEntityName AS GroupDesignation" , "[DocumentFinanceDetail.GroupOid]" , "[DocumentFinanceDetail.GroupDesignation] ([DocumentFinanceDetail.GroupCode])" , reportFilter , reportFilterHumanReadable , true ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_GROUP_PER_PAYMENT_METHOD: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "fmPaymentMethod, pmPaymentMethodOrd, pmPaymentMethodCode, pmPaymentMethodDesignation" , "fmPaymentMethod AS GroupOid, pmPaymentMethodOrd AS GroupOrd, pmPaymentMethodCode AS GroupCode, pmPaymentMethodDesignation AS GroupDesignation" , "[DocumentFinanceDetail.GroupOid]" , "[DocumentFinanceDetail.GroupDesignation] ([DocumentFinanceDetail.GroupCode])" , (string.IsNullOrEmpty(reportFilter)) ? "fmPaymentMethod IS NOT NULL" : string.Format("{0} AND fmPaymentMethod IS NOT NULL", reportFilter) , reportFilterHumanReadable , true ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_GROUP_PER_PAYMENT_CONDITION: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "fmPaymentCondition, pcPaymentConditionOrd, pcPaymentConditionCode, pcPaymentConditionDesignation" , "fmPaymentCondition AS GroupOid, pcPaymentConditionOrd AS GroupOrd, pcPaymentConditionCode AS GroupCode, pcPaymentConditionDesignation AS GroupDesignation" , "[DocumentFinanceDetail.GroupOid]" , "[DocumentFinanceDetail.GroupDesignation] ([DocumentFinanceDetail.GroupCode])" , (string.IsNullOrEmpty(reportFilter)) ? "fmPaymentCondition IS NOT NULL" : string.Format("{0} AND fmPaymentCondition IS NOT NULL", reportFilter) , reportFilterHumanReadable , true ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_GROUP_PER_CURRENCY: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "fmCurrency, crCurrencyOrd, crCurrencyCode, crCurrencyDesignation" , "fmCurrency AS GroupOid, crCurrencyOrd AS GroupOrd, crCurrencyCode AS GroupCode, crCurrencyDesignation AS GroupDesignation" , "[DocumentFinanceDetail.GroupOid]" , "[DocumentFinanceDetail.GroupDesignation] ([DocumentFinanceDetail.GroupCode])" , reportFilter , reportFilterHumanReadable , true ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_GROUP_PER_COUNTRY: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "ccCountry, ccCountryOrd, ccCountryCode, ccCountryDesignation" , "ccCountry AS GroupOid, ccCountryOrd AS GroupOrd, ccCountryCode AS GroupCode, ccCountryDesignation AS GroupDesignation" , "[DocumentFinanceDetail.GroupOid]" , "[DocumentFinanceDetail.GroupDesignation] ([DocumentFinanceDetail.GroupCode])" , reportFilter , reportFilterHumanReadable , true ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_GROUP_PER_FAMILY: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "afFamily, afFamilyOrd, afFamilyCode, afFamilyDesignation" , "afFamily AS GroupOid, afFamilyOrd AS GroupOrd, afFamilyCode AS GroupCode, afFamilyDesignation AS GroupDesignation" , "[DocumentFinanceDetail.GroupOid]" , "[DocumentFinanceDetail.GroupDesignation] ([DocumentFinanceDetail.GroupCode])" , reportFilter , reportFilterHumanReadable , true ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_GROUP_PER_FAMILY_AND_SUBFAMILY: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "sfSubFamily, sfSubFamilyOrd, sfSubFamilyCode, sfSubFamilyDesignation" , "sfSubFamily AS GroupOid, sfSubFamilyOrd AS GroupOrd, sfSubFamilyCode AS GroupCode, sfSubFamilyDesignation AS GroupDesignation" , "[DocumentFinanceDetail.GroupOid]" , "[DocumentFinanceDetail.GroupDesignation] ([DocumentFinanceDetail.GroupCode])" , reportFilter , reportFilterHumanReadable , true ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_GROUP_PER_PLACE: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "cpPlace, cpPlaceOrd, cpPlaceCode, cpPlaceDesignation" , "cpPlace AS GroupOid, cpPlaceOrd AS GroupOrd, cpPlaceCode AS GroupCode, cpPlaceDesignation AS GroupDesignation" , "[DocumentFinanceDetail.GroupOid]" , "[DocumentFinanceDetail.GroupDesignation] ([DocumentFinanceDetail.GroupCode])" , (string.IsNullOrEmpty(reportFilter)) ? "cpPlace IS NOT NULL" : string.Format("{0} AND cpPlace IS NOT NULL", reportFilter) , reportFilterHumanReadable , true ); break; case ReportsTypeToken.REPORT_SALES_DETAIL_GROUP_PER_PLACE_TABLE: CustomReport.ProcessReportDocumentDetail(displayMode , token.ToString().ToLower() , "dmPlaceTable, ctPlaceTableOrd, ctPlaceTableCode, ctPlaceTableDesignation" , "dmPlaceTable AS GroupOid, ctPlaceTableOrd AS GroupOrd, ctPlaceTableCode AS GroupCode, ctPlaceTableDesignation AS GroupDesignation" , "[DocumentFinanceDetail.GroupOid]" , "[DocumentFinanceDetail.GroupDesignation] ([DocumentFinanceDetail.GroupCode])" , (string.IsNullOrEmpty(reportFilter)) ? "dmPlaceTable IS NOT NULL" : string.Format("{0} AND dmPlaceTable IS NOT NULL", reportFilter) , reportFilterHumanReadable , true ); break; //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // Where it is Called? /* * case ReportsTypeToken.REPORT_SALES_PER_FAMILY_AND_SUBFAMILY: * CustomReport.ProcessReportDocumentDetail(displayMode * , Resx.ResourceManager.GetString(token.ToString().ToLower()) * , "[DocumentFinanceDetail.ArticleFamilyCode]" * , "[DocumentFinanceDetail.ArticleFamilyDesignation] ([DocumentFinanceDetail.ArticleFamilyCode])" * , false * ); * break; * // Where it is Called? * case ReportsTypeToken.REPORT_SALES_PER_ZONE_TABLE: * CustomReport.ProcessReportDocumentDetail(displayMode * , Resx.ResourceManager.GetString(token.ToString().ToLower()) * , "[DocumentFinanceDetail.ArticleFamilyCode]" * , "[DocumentFinanceDetail.ArticleFamilyDesignation] ([DocumentFinanceDetail.ArticleFamilyCode])" * , true * ); * break; */ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // Other Non REPORT_SALES_* Reports // Auxiliar Tables case ReportsTypeToken.REPORT_LIST_FAMILY_SUBFAMILY_ARTICLES: // Where it is Called? CustomReport.ProcessReportArticle(displayMode); break; case ReportsTypeToken.REPORT_LIST_CUSTOMERS: CustomReport.ProcessReportCustomer(displayMode); break; // Other Reports case ReportsTypeToken.REPORT_LIST_AUDIT_TABLE: CustomReport.ProcessReportSystemAudit(displayMode, reportFilter, reportFilterHumanReadable); break; case ReportsTypeToken.REPORT_LIST_STOCK_MOVEMENTS: CustomReport.ProcessReportArticleStockMovement(displayMode, reportFilter, reportFilterHumanReadable); break; case ReportsTypeToken.REPORT_LIST_CURRENT_ACCOUNT: CustomReport.ProcessReportDocumentFinanceCurrentAccount(displayMode, reportFilter, reportFilterHumanReadable); break; case ReportsTypeToken.REPORT_LIST_USER_COMMISSION: CustomReport.ProcessReportUserCommission(displayMode, reportFilter, reportFilterHumanReadable); break; // ABove are not Implemented Yet case ReportsTypeToken.REPORT_TOTAL_PER_FAMILY: break; case ReportsTypeToken.REPORT_TOP_CLOSE_EMPLOYEES: break; case ReportsTypeToken.REPORT_OCCUPATION_AVERAGE: break; case ReportsTypeToken.REPORT_ZONE_TOTAL: break; case ReportsTypeToken.REPORT_CLOSE_PEAK_HOUR: break; case ReportsTypeToken.REPORT_TOP_OFFERS: break; case ReportsTypeToken.REPORT_TOP_EMPLOYEE_RECORDS: break; case ReportsTypeToken.REPORT_RECORD_PEAK_HOUR: break; case ReportsTypeToken.REPORT_EMPLOYEE_MOVENTS: break; case ReportsTypeToken.REPORT_ACOUNT_BALANCE: break; case ReportsTypeToken.REPORT_WITHHOLDING_TAX: break; case ReportsTypeToken.REPORT_BALANCE_SHEET: break; case ReportsTypeToken.REPORT_SERVICE_HOURS: break; case ReportsTypeToken.REPORT_COURIER_DELIVER: break; case ReportsTypeToken.REPORT_CANCELED_ARTICLES_PER_EMPLOYEE: break; case ReportsTypeToken.REPORT_LIST_INVENTORY: break; case ReportsTypeToken.REPORT_DISCOUNTS_PER_USER: break; case ReportsTypeToken.REPORT_LIST_CONSUMPTION_PER_USER: break; case ReportsTypeToken.REPORT_CASH_TOTAL: break; case ReportsTypeToken.REPORT_LIST_WORKSESSION: break; case ReportsTypeToken.REPORT_LIST_CLOSE_WORKSESSION: break; default: _log.Error(String.Format("Undetected Token: [{0}]", token)); break; } } }
public CustomReport InsertCustomReport(CustomReport entity) { return(_iCustomReportRepository.InsertCustomReport(entity)); }
private void customReportToolStripMenuItem_Click(object sender, EventArgs e) { CustomReport customReport = new CustomReport(Project, road, sign, other, this); customReport.newCustomReport(); }
private static bool SystemPrintInsert(FIN_DocumentFinanceMaster pDocumentFinanceMaster, FIN_DocumentFinancePayment pDocumentFinancePayment, string pPrinterDesignation, int pPrintCopies, List <int> pCopyNames, bool pSecondPrint, string pPrintMotive, SYS_UserDetail pUserDetail, POS_ConfigurationPlaceTerminal pConfigurationPlaceTerminal) { bool result = false; try { //Start UnitOfWork using (UnitOfWork uowSession = new UnitOfWork()) { string designation = String.Empty; //Get Objects into Current UOW Session SYS_UserDetail userDetail = (SYS_UserDetail)FrameworkUtils.GetXPGuidObject(uowSession, typeof(SYS_UserDetail), pUserDetail.Oid); POS_ConfigurationPlaceTerminal configurationPlaceTerminal = (POS_ConfigurationPlaceTerminal)FrameworkUtils.GetXPGuidObject(uowSession, typeof(POS_ConfigurationPlaceTerminal), pConfigurationPlaceTerminal.Oid); //Convert CopyNames List to Comma Delimited String string copyNamesCommaDelimited = CustomReport.CopyNamesCommaDelimited(pCopyNames); //SystemPrint SYS_SystemPrint systemPrint = new SYS_SystemPrint(uowSession) { Date = FrameworkUtils.CurrentDateTimeAtomic(), Designation = designation, PrintCopies = pPrintCopies, CopyNames = copyNamesCommaDelimited, SecondPrint = pSecondPrint, UserDetail = userDetail, Terminal = configurationPlaceTerminal }; if (pPrintMotive != String.Empty) { systemPrint.PrintMotive = pPrintMotive; } //Mode: DocumentFinanceMaster if (pDocumentFinanceMaster != null) { FIN_DocumentFinanceMaster documentFinanceMaster = (FIN_DocumentFinanceMaster)FrameworkUtils.GetXPGuidObject(uowSession, typeof(FIN_DocumentFinanceMaster), pDocumentFinanceMaster.Oid); systemPrint.DocumentMaster = documentFinanceMaster; designation = string.Format("{0} {1} : {2}", Resx.global_printed, documentFinanceMaster.DocumentType.Designation, documentFinanceMaster.DocumentNumber); //Update DocumentFinanceMaster if (!documentFinanceMaster.Printed) { documentFinanceMaster.Printed = true; } } //Mode: DocumentFinancePayment if (pDocumentFinancePayment != null) { FIN_DocumentFinancePayment documentFinancePayment = (FIN_DocumentFinancePayment)FrameworkUtils.GetXPGuidObject(uowSession, typeof(FIN_DocumentFinancePayment), pDocumentFinancePayment.Oid); systemPrint.DocumentPayment = documentFinancePayment; designation = string.Format("{0} {1} : {2}", Resx.global_printed, documentFinancePayment.DocumentType.Designation, documentFinancePayment.PaymentRefNo); } systemPrint.Designation = designation; try { //Commit UOW Changes : Before get current OrderMain uowSession.CommitChanges(); //Audit FrameworkUtils.Audit("SYSTEM_PRINT_FINANCE_DOCUMENT", designation); result = true; } catch (Exception ex) { _log.Error(ex.Message, ex); uowSession.RollbackTransaction(); } } } catch (Exception ex) { _log.Error(ex.Message, ex); } return(result); }
//OverLoads DocumentFinancePayment private static bool SystemPrintInsert(FIN_DocumentFinancePayment pDocumentFinancePayment, string PrinterDesignation) { List <int> copyNames = CustomReport.CopyNames(pDocumentFinancePayment.DocumentType.PrintCopies); return(SystemPrintInsert(null, pDocumentFinancePayment, PrinterDesignation, 1, copyNames, false, String.Empty, GlobalFramework.LoggedUser, GlobalFramework.LoggedTerminal)); }
public static PrintDialogResponse GetDocumentFinancePrintProperties(Window pSourceWindow, fin_documentfinancemaster pDocumentFinanceMaster) { //Log4Net log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //Init Response PrintDialogResponse result = new PrintDialogResponse(ResponseType.Cancel); try { //TODO: Xpo Required to use ExecuteScalar, else we dont have real value but a cached value //Get Fresh Object to get Printed Status //DocumentFinanceMaster documentFinanceMaster = (DocumentFinanceMaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(DocumentFinanceMaster), pDocumentFinanceMaster.Oid); //bool printed = documentFinanceMaster.Printed; //Fix Cache Problem var sqlResPrinted = GlobalFramework.SessionXpo.ExecuteScalar(string.Format( "SELECT Printed FROM fin_documentfinancemaster WHERE Oid = '{0}';", pDocumentFinanceMaster.Oid) ); bool printed = (sqlResPrinted != null) ? Convert.ToBoolean(sqlResPrinted) : false; //Call Re-Print Dialog if (printed) { PosDocumentFinancePrintDialog dialog = new PosDocumentFinancePrintDialog(pSourceWindow, DialogFlags.DestroyWithParent, pDocumentFinanceMaster); result.Response = (ResponseType)dialog.Run(); if (result.Response == ResponseType.Ok) { //Modify Result with Dialog Properties result.Items = dialog._checkButtonCopyNamesBoxGroup.Items; //Generate CopyNames from CheckButtonCopyNamesBoxGroup.Items result.CopyNames = new List <int>(); foreach (var item in dialog._checkButtonCopyNamesBoxGroup.Items) { result.CopyNames.Add(item.Key); } result.SecondCopy = dialog._secondCopy; if (dialog._entryBoxValidationBoxMotive != null) { result.Motive = dialog._entryBoxValidationBoxMotive.EntryValidation.Text; } } dialog.Destroy(); } //Normal Print Without Dialog else { //Modify Result result.Response = ResponseType.Ok; //Initialize CopyNames List from PrintCopies result.CopyNames = CustomReport.CopyNames(pDocumentFinanceMaster.DocumentType.PrintCopies); } } catch (Exception ex) { log.Error(ex.Message, ex); } return(result); }
public Dictionary <string, int> ImportCustomReports(Dictionary <string, SkuReportStatusModel> skus, DataTable excelInfos) { var result = new Dictionary <string, int>(); var successCount = 0; var failCount = 0; if (skus == null || skus.Count == 0) { return(null); } var skuDic = new Dictionary <string, int>(); List <CustomReport> importData = new List <CustomReport>(); Dictionary <string, string> fails = new Dictionary <string, string>(); List <int> customedSkuLineIDs = new List <int>(); foreach (DataRow dr in excelInfos.Rows) { var skuNo = dr[2] == DBNull.Value ? "" : dr[2].ToString(); if (String.IsNullOrWhiteSpace(skuNo)) { continue; } if (!skus.Keys.Contains(skuNo) && !fails.Keys.Contains(skuNo)) { failCount++; fails.Add(skuNo, "待審核列表中沒有與之匹配的SKU編號"); continue; } var skuInfo = skus[skuNo]; if (skuInfo.ReportStatus == -1 && !fails.Keys.Contains(skuNo)) { failCount++; fails.Add(skuNo, "對應的SKU編號不需要報備"); continue; } successCount++; var customReport = new CustomReport() { Sku = skuNo, CustomsUnit = dr[3] == DBNull.Value ? "" : dr[3].ToString(), ModelForCustoms = dr[4] == DBNull.Value ? "" : dr[4].ToString(), InspectionNo = dr[5] == DBNull.Value ? "" : dr[5].ToString(), PrepardNo = dr[6] == DBNull.Value ? "" : dr[6].ToString(), TaxCode = dr[7] == DBNull.Value ? "" : dr[7].ToString(), HSCode = dr[8] == DBNull.Value ? "" : dr[8].ToString(), GnoCode = dr[9] == DBNull.Value ? "" : dr[9].ToString(), UOM = dr[10] == DBNull.Value ? "" : dr[10].ToString(), TaxRate = dr[11] == DBNull.Value ? "0" : dr[11].ToString(), }; if (HasCustom(customReport)) { customedSkuLineIDs.Add(skuInfo.Id); customedSkuLineIDs.AddRange(skuInfo.ConnectIDs); } importData.Add(customReport); } var jm = new CustomReportJsonModel(); jm.CustomReports = importData.ToArray(); productDAL.InsertTemStorageCusReports(jm); productDAL.UpdateSkuReportStatus(customedSkuLineIDs); var batchNO = productDAL.InsertImportError(fails); result.Add("true", successCount); result.Add("false", failCount); result.Add("batchNO", batchNO); return(result); }
public CustomReport UpdateCustomReport(CustomReport entity) { return(_iCustomReportRepository.UpdateCustomReport(entity)); }