protected void GenerateHinxFiles(HinxFile.ClaimType claimType, DateTime fromDate, DateTime toDate, int site_id) { try { int startTimeGenerateReport = Environment.TickCount; HinxFile hinxFile = new HinxFile(claimType, site_id); HinxFile.ReportItems reportItems = hinxFile.GenerateReportItems(fromDate, toDate, false); double executionTimeGenerateReport = (double)(Environment.TickCount - startTimeGenerateReport) / 1000.0; // Commented out since they want to allow overwrite of old files rather than error message saying remove them to re-generate // //string[] existingHinxFiles = hinxFile.GetExistingHinxFiles(reportItems.reportTable); //if (existingHinxFiles.Length > 0) //{ // int itemsPerLine = 8; // string existing = string.Empty; // for (int i = 0; i < existingHinxFiles.Length; i++) // existing += (i != 0 && i % itemsPerLine == 0 ? "<br />" : "") + existingHinxFiles[i] + (i != existingHinxFiles.Length - 1 ? ", " : ""); // HideTableAndSetErrorMessage("Can not generate while the following eclaim files already exist : " + "<br />" + string.Join("<br />", existing)); // return; //} string failedItemsMessage = string.Empty; try { hinxFile.CreateXML(reportItems.ToBeClaimed); } catch (System.ComponentModel.Win32Exception) { Emailer.SimpleErrorEmail("HINX AUTO Generation - Failed to generate - connection to network files currently unavailable."); return; } catch (HINXUnsuccessfulItemsException ex) { failedItemsMessage = ex.Message; } } catch (CustomMessageException cmEx) { Emailer.SimpleErrorEmail("HINX AUTO Generation - " + cmEx.Message); } catch (Exception ex) { Emailer.SimpleErrorEmail("HINX AUTO Generation - " + ex.ToString()); } }
protected void GenerateReport(HinxFile.ClaimType claimType, DateTime fromDate, DateTime toDate) { try { HinxFile hinxFile = new HinxFile(claimType, Convert.ToInt32(Session["SiteID"])); HinxFile.ReportItems reportItems = hinxFile.GenerateReportItems(fromDate, toDate, false); GenerateReport(reportItems.reportTable); } catch (CustomMessageException cmEx) { SetErrorMessage(cmEx.Message); } catch (Exception ex) { SetErrorMessage("", ex.ToString()); } }
protected void GenerateHinxFiles(HinxFile.ClaimType claimType, DateTime fromDate, DateTime toDate) { try { if (Convert.ToInt32(SystemVariableDB.GetByDescr("AutoMedicareClaiming").Value) != 1) { SetErrorMessage("Medicare claiming has not been turned on for this customer. Go to website settings and turn it on before running it."); return; } int startTimeGenerateReport = Environment.TickCount; HinxFile hinxFile = new HinxFile(claimType, Convert.ToInt32(Session["SiteID"])); HinxFile.ReportItems reportItems = hinxFile.GenerateReportItems(fromDate, toDate, false); double executionTimeGenerateReport = (double)(Environment.TickCount - startTimeGenerateReport) / 1000.0; // Commented out since they want to allow overwrite of old files rather than error message saying remove them to re-generate // //string[] existingHinxFiles = hinxFile.GetExistingHinxFiles(reportItems.reportTable); //if (existingHinxFiles.Length > 0) //{ // int itemsPerLine = 8; // string existing = string.Empty; // for (int i = 0; i < existingHinxFiles.Length; i++) // existing += (i != 0 && i % itemsPerLine == 0 ? "<br />" : "") + existingHinxFiles[i] + (i != existingHinxFiles.Length - 1 ? ", " : ""); // HideTableAndSetErrorMessage("Can not generate while the following eclaim files already exist : " + "<br />" + string.Join("<br />", existing)); // return; //} int startTimeGenerateFiles = Environment.TickCount; string failedItemsMessage = string.Empty; try { hinxFile.CreateXML(reportItems.ToBeClaimed); } catch (System.ComponentModel.Win32Exception) { SetErrorMessage("Failed to generate - connection to network files currently unavailable."); return; } catch (HINXUnsuccessfulItemsException ex) { failedItemsMessage = ex.Message; } double executionTimeGenerateFiles = (double)(Environment.TickCount - startTimeGenerateFiles) / 1000.0; SetErrorMessage("Successfully generated for " + reportItems.ToBeClaimed.Length + " invoices in " + executionTimeGenerateFiles + " seconds [generated report in " + executionTimeGenerateReport + " seconds]" + (failedItemsMessage.Length == 0 ? "" : "<br /><br />" + failedItemsMessage)); } catch (CustomMessageException cmEx) { SetErrorMessage(cmEx.Message); } catch (Exception ex) { SetErrorMessage("", ex.ToString()); } }
protected bool GenerateByEclaim(string eclaimNbr) { Invoice invoice = InvoiceDB.GetByClaimNumber(eclaimNbr); if (invoice == null) return false; if (DateTime.Now.Subtract(invoice.InvoiceDateAdded).TotalDays > 370) throw new Exception("Invoice is over 2 years old"); if (invoice.PayerOrganisation.OrganisationID != -1 && invoice.PayerOrganisation.OrganisationID != -2) throw new Exception("Not a medicare or dva invoice"); HinxFile.ClaimType claimType = invoice.PayerOrganisation.OrganisationID == -1 ? HinxFile.ClaimType.Medicare : HinxFile.ClaimType.DVA; HinxFile hinxFile = new HinxFile(claimType, Convert.ToInt32(Session["SiteID"])); hinxFile.CreateXML(new Invoice[] { invoice }); return true; }