private async void ExportMap_Click(object sender, RoutedEventArgs e) { try { progress.Visibility = Visibility.Visible; PrintParameters printParameters = new PrintParameters(MyMapView) { ExportOptions = new ExportOptions() { Dpi = 96, OutputSize = new Size(MyMapView.ActualWidth, MyMapView.ActualHeight) }, LayoutTemplate = (string)comboLayout.SelectedItem ?? string.Empty, Format = (string)comboFormat.SelectedItem, }; var result = await _printTask.PrintAsync(printParameters); Process.Start(result.Uri.AbsoluteUri); } catch (Exception ex) { MessageBox.Show(ex.Message, "Sample Error"); } finally { progress.Visibility = Visibility.Collapsed; } }
private static void RegenerateStatements(PrintParameters pars, List <DetailsResult> statements) { var process = PXGraph.CreateInstance <StatementCycleProcessBO>(); var cycle = process.CyclesList.SelectSingle(pars.StatementCycleId); var customerSelect = new PXSelect <Customer, Where <Customer.bAccountID, Equal <Required <DetailsResult.customerID> > > >(process); int i = 0; List <Customer> customers = new List <Customer>(); foreach (DetailsResult res in statements) { if (ARStatementProcess.CheckForUnprocessedPPD(process, pars.StatementCycleId, pars.StatementDate, res.CustomerID)) { PXFilteredProcessing <DetailsResult, PrintParameters> .SetError(i, new PXSetPropertyException(Messages.UnprocessedPPDExists, PXErrorLevel.RowError)); } else { Customer customer = customerSelect.SelectSingle(res.CustomerID); if (customer != null) { customers.Add(customer); } } i++; } if (cycle == null || customers.Any() == false) { return; } StatementCycleProcessBO.RegenerateStatements(process, cycle, customers); }
public static void Email(PrintParameters filter, List <DetailsResult> list, bool markOnly) { ARDunningLetterUpdate graph = CreateInstance <ARDunningLetterUpdate>(); int i = 0; bool failed = false; foreach (DetailsResult it in list) { try { graph.EMailDL(it.DunningLetterID.Value, markOnly, filter.ShowAll == true); PXFilteredProcessing <DetailsResult, PrintParameters> .SetCurrentItem(it); PXFilteredProcessing <DetailsResult, PrintParameters> .SetProcessed(); } catch (Exception e) { PXFilteredProcessing <DetailsResult, PrintParameters> .SetError(i, e); failed = true; } i++; } if (failed) { throw new PXException(ErrorMessages.MailSendFailed); } }
protected virtual void PrintParameters_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { PrintParameters o = (PrintParameters)e.Row; if (o != null) { PrintParameters filter = (PrintParameters)this.Filter.Cache.CreateCopy(o); switch (o.Action) { case 0: Details.SetProcessDelegate(list => Print(filter, list, false)); break; case 1: Details.SetProcessDelegate(list => Email(filter, list, false)); break; case 2: Details.SetProcessDelegate(list => Email(filter, list, true)); break; case 3: Details.SetProcessDelegate(list => Print(filter, list, true)); break; case 4: Details.SetProcessDelegate(list => Release(filter, list)); break; } } }
Stream(ArrayList data, PrintParameters prnParams) { data.Add(new Snoop.Data.ClassSeparator(typeof(PrintParameters))); data.Add(new Snoop.Data.String("Color depth", prnParams.ColorDepth.ToString())); data.Add(new Snoop.Data.String("Hidden line views", prnParams.HiddenLineViews.ToString())); data.Add(new Snoop.Data.Bool("Hide crop boundaries", prnParams.HideCropBoundaries)); data.Add(new Snoop.Data.Bool("Hide refor work planes", prnParams.HideReforWorkPlanes)); // TBD - Check property name (seems to be spelt wrong) data.Add(new Snoop.Data.Bool("Hide scope boxes", prnParams.HideScopeBoxes)); data.Add(new Snoop.Data.Bool("Hide unreferenced view tags", prnParams.HideUnreferencedViewTags)); // TBD - Check property name (seems to be spelt wrong) data.Add(new Snoop.Data.String("Margin type", prnParams.MarginType.ToString())); data.Add(new Snoop.Data.String("Page orientation", prnParams.PageOrientation.ToString())); try { data.Add(new Snoop.Data.String("Paper placement", prnParams.PaperPlacement.ToString())); } catch (System.Exception ex) { data.Add(new Snoop.Data.Exception("Paper placement", ex)); } data.Add(new Snoop.Data.Object("Paper size", prnParams.PaperSize)); data.Add(new Snoop.Data.Object("Paper source", prnParams.PaperSource)); try { data.Add(new Snoop.Data.String("Raster quality", prnParams.RasterQuality.ToString())); } catch (System.Exception ex) { data.Add(new Snoop.Data.Exception("Raster quality", ex)); } try { data.Add(new Snoop.Data.Double("User defined margin X", prnParams.UserDefinedMarginX)); } catch (System.Exception ex) { data.Add(new Snoop.Data.Exception("User defined margin X", ex)); } try { data.Add(new Snoop.Data.Double("User defined margin Y", prnParams.UserDefinedMarginY)); } catch (System.Exception ex) { data.Add(new Snoop.Data.Exception("User defined margin Y", ex)); } data.Add(new Snoop.Data.Bool("View links in blue", prnParams.ViewLinksinBlue)); try { data.Add(new Snoop.Data.Int("Zoom", prnParams.Zoom)); } catch (System.Exception ex) { data.Add(new Snoop.Data.Exception("Zoom", ex)); } try { data.Add(new Snoop.Data.String("Zoom type", prnParams.ZoomType.ToString())); } catch (System.Exception ex) { data.Add(new Snoop.Data.Exception("Zoom type", ex)); } }
public static void EmailStatements(PrintParameters filter, List <DetailsResult> list, bool markOnly) { ARStatementUpdate graph = CreateInstance <ARStatementUpdate>(); int i = 0; bool failed = false; foreach (DetailsResult it in list) { try { graph.EMailStatement(filter.BranchCD, it.CustomerID, filter.StatementDate, filter.CuryStatements == true? it.CuryID: null, markOnly, filter.ShowAll == true); if (!markOnly) { it.Emailed = true; } PXFilteredProcessing <DetailsResult, PrintParameters> .SetCurrentItem(it); PXFilteredProcessing <DetailsResult, PrintParameters> .SetProcessed(); } catch (Exception e) { PXFilteredProcessing <DetailsResult, PrintParameters> .SetError(i, e); failed = true; } i++; } if (failed) { throw new PXException(ErrorMessages.MailSendFailed); } }
public static void Release(PrintParameters filter, List <DetailsResult> list) { if (list.Count > 0) { bool failed = false; ARDunningLetterMaint graph = PXGraph.CreateInstance <ARDunningLetterMaint>(); int i = 0; foreach (DetailsResult res in list) { try { ARDunningLetter doc = PXSelect <ARDunningLetter, Where <ARDunningLetter.dunningLetterID, Equal <Required <DetailsResult.dunningLetterID> > > > .Select(graph, res.DunningLetterID); ARDunningLetterMaint.ReleaseProcess(graph, doc); PXFilteredProcessing <DetailsResult, PrintParameters> .SetProcessed(); } catch (Exception e) { failed = true; PXFilteredProcessing <DetailsResult, PrintParameters> .SetError(i, e); } i++; } if (failed) { throw new PXException(Messages.OneOrMoreItemsAreNotReleased); } } }
protected virtual void PrintParameters_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { PrintParameters row = (PrintParameters)e.Row; if (row != null) { PrintParameters filter = (PrintParameters)this.Filter.Cache.CreateCopy(row); switch (row.Action) { case ActionTypes.Print: Details.SetProcessDelegate(list => Print(filter, list, false)); break; case ActionTypes.Email: Details.SetProcessDelegate(list => Email(filter, list, false)); break; case ActionTypes.MarkDontEmail: Details.SetProcessDelegate(list => Email(filter, list, true)); break; case ActionTypes.MarkDontPrint: Details.SetProcessDelegate(list => Print(filter, list, true)); break; case ActionTypes.Release: Details.SetProcessDelegate(list => Release(filter, list)); row.ShowAll = false; break; } PXUIFieldAttribute.SetEnabled <PrintParameters.showAll>(sender, row, row.Action != ActionTypes.Release); } }
/// <summary> /// Generates a list of documents that meet the filter criteria. /// This list is used for display in the processing screen /// </summary> /// <returns>List of Dunning Letters</returns> protected virtual IEnumerable details() { PrintParameters header = Filter.Current; List <DetailsResult> result = new List <DetailsResult>(); if (header == null) { yield break; } GL.Company company = PXSelect <GL.Company> .Select(this); foreach (PXResult <ARDunningLetter, Customer> it in PXSelectJoin <ARDunningLetter, InnerJoin <Customer, On <Customer.bAccountID, Equal <ARDunningLetter.bAccountID> > >, Where <ARDunningLetter.dunningLetterDate, Between <Required <ARDunningLetter.dunningLetterDate>, Required <ARDunningLetter.dunningLetterDate> >, And <ARDunningLetter.consolidated, Equal <Required <ARDunningLetter.consolidated> > > >, OrderBy <Asc <ARDunningLetter.bAccountID> > > .Select(this, header.BeginDate, header.EndDate, this.Consolidated)) { DetailsResult res = new DetailsResult(); ARDunningLetter dl = it; Customer cust = it; res.Copy(this, dl, cust); if (this.Filter.Current.Action == 0) { if (header.ShowAll == false && (dl.DontPrint == true || dl.Printed == true)) { continue; } } if (this.Filter.Current.Action == 1) { if (header.ShowAll == false && (dl.DontEmail == true || dl.Emailed == true)) { continue; } } if (this.Filter.Current.Action == 2) { if (header.ShowAll == false && (dl.DontEmail == true || dl.Emailed == true)) { continue; } } result.Add(res); } foreach (var item in result) { Details.Cache.SetStatus(item, PXEntryStatus.Held); yield return(item); } Details.Cache.IsDirty = false; }
public static void Print(PrintParameters filter, List <DetailsResult> list, bool markOnly) { bool failed = false; ARDunningLetterUpdate graph = PXGraph.CreateInstance <ARDunningLetterUpdate>(); PXReportRequiredException ex = null; foreach (DetailsResult t in list) { int? L = t.DunningLetterID; ARDunningLetter doc = graph.DL.Select(L.Value); PXFilteredProcessing <DetailsResult, PrintParameters> .SetCurrentItem(t); if (doc.Released == false || doc.Voided == true) { PXFilteredProcessing <DetailsResult, PrintParameters> .SetError(CA.Messages.DocumentStatusInvalid); failed = true; continue; } if (markOnly) { if (filter.ShowAll != true) { doc.DontPrint = true; graph.docs.Cache.Update(doc); PXFilteredProcessing <DetailsResult, PrintParameters> .SetProcessed(); } } else { Dictionary <string, string> d = new Dictionary <string, string>(); d["ARDunningLetter.DunningLetterID"] = L.ToString(); if (doc.Printed != true) { doc.Printed = true; graph.docs.Cache.Update(doc); PXFilteredProcessing <DetailsResult, PrintParameters> .SetProcessed(); } ex = PXReportRequiredException.CombineReport(ex, GetCustomerReportID(graph, "AR661000", t), d); } } graph.Save.Press(); if (ex != null) { throw ex; } if (failed) { throw new PXException(Messages.OneOrMoreItemsAreNotProcessed); } }
private void EnableDateField(PrintParameters filter) { if (filter == null) { return; } bool enableDate = filter.Action != PrintParameters.Actions.Regenerate; PXUIFieldAttribute.SetEnabled <PrintParameters.statementDate>(Filter.Cache, filter, enableDate); }
private void SetStatementDateFromCycle(PrintParameters filter) { if (!string.IsNullOrEmpty(filter.StatementCycleId)) { ARStatementCycle cycle = PXSelect <ARStatementCycle, Where <ARStatementCycle.statementCycleId, Equal <Required <ARStatementCycle.statementCycleId> > > > .Select(this, filter.StatementCycleId); filter.StatementDate = cycle.LastStmtDate; } }
/// <summary> /// Проверяет, были ли внесены изменения в параметры печати. /// Ревит возвращает ошибку, если попытаться сохранить параметры печати, не изменив их. /// </summary> /// <param name="pset"></param> /// <param name="printSettings"></param> /// <returns></returns> public static bool PrintSettingsEquals(PrintSetting pset, YayPrintSettings printSettings) { PrintParameters pParams = pset.PrintParameters; bool c1 = printSettings.colorsType.Equals(pParams.ColorDepth); bool c2 = printSettings.hiddenLineProcessing.Equals(pParams.HiddenLineViews); bool c3 = printSettings.rasterQuality.Equals(pParams.RasterQuality); bool check = c1 && c2 && c3; return(check); }
protected virtual void PrintParameters_PrinterName_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { PrintParameters row = (PrintParameters)e.Row; if (row != null) { if (!IsPrintingAllowed(row)) { e.NewValue = null; } } }
protected virtual void PrintParameters_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { ARSetup setup = ARSetup.Current; bool bb = !(setup.ConsolidatedStatement ?? false); PrintParameters row = (PrintParameters)e.Row; if (row != null) { row.BranchCD = null; if (!bb) { row.BranchID = null; //Force null for the non-consolidated statements } if (row.BranchID != null) { Branch BrS = PXSelect <Branch, Where <Branch.branchID, Equal <Required <Branch.branchID> > > > .Select(this, row.BranchID); if (BrS != null) { row.BranchCD = BrS.BranchCD; } } PXUIFieldAttribute.SetVisible <PrintParameters.branchID>(sender, null, bb); PXUIFieldAttribute.SetEnabled <PrintParameters.statementDate>(sender, row, row.Action != PrintParameters.Actions.Regenerate); PrintParameters filter = (PrintParameters)this.Filter.Cache.CreateCopy(row); switch (row.Action) { case 0: Details.SetProcessDelegate(list => PrintStatements(filter, list, false)); break; case 1: Details.SetProcessDelegate(list => EmailStatements(filter, list, false)); break; case 2: Details.SetProcessDelegate(list => EmailStatements(filter, list, true)); break; case 3: Details.SetProcessDelegate(list => PrintStatements(filter, list, true)); break; case 4: Details.SetProcessDelegate(list => RegenerateStatements(filter, list)); break; } } }
private void ExportMap_Click(object sender, RoutedEventArgs e) { if (printTask == null || printTask.IsBusy) return; PrintParameters printParameters = new PrintParameters(MyMap) { ExportOptions = new ExportOptions() { Dpi = 96, OutputSize = new Size(MyMap.ActualWidth, MyMap.ActualHeight) }, LayoutTemplate = (string)LayoutTemplates.SelectedItem ?? string.Empty, Format = (string)Formats.SelectedItem, }; printTask.ExecuteAsync(printParameters); }
protected virtual void PrintParameters_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e) { PrintParameters row = (PrintParameters)e.Row; if (row != null) { if (row.Action == 4) { row.ShowAll = false; } PXUIFieldAttribute.SetEnabled <PrintParameters.showAll>(sender, row, row.Action != 4); } Details.Cache.Clear(); }
public void PrintReportInDeviceHub(string reportID, Dictionary <string, string> parametersDictionary, string printerName, int?branchID) { Dictionary <string, PXReportRequiredException> reportsToPrint = new Dictionary <string, PXReportRequiredException>(); PrintParameters filter = new PrintParameters(); filter.PrintWithDeviceHub = true; filter.DefinePrinterManually = true; filter.PrinterName = printerName; reportsToPrint = PX.SM.SMPrintJobMaint.AssignPrintJobToPrinter(reportsToPrint, parametersDictionary, filter, new NotificationUtility(this).SearchPrinter, CRNotificationSource.BAccount, reportID, reportID, branchID); if (reportsToPrint != null) { PX.SM.SMPrintJobMaint.CreatePrintJobGroups(reportsToPrint); } }
protected virtual void PrintParameters_StatementCycleId_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { PrintParameters row = (PrintParameters)e.Row; if (!string.IsNullOrEmpty(row.StatementCycleId)) { ARStatementCycle cycle = PXSelect <ARStatementCycle, Where <ARStatementCycle.statementCycleId, Equal <Required <ARStatementCycle.statementCycleId> > > > .Select(this, row.StatementCycleId); row.StatementDate = cycle.LastStmtDate; EnableDateField(row); } }
private static void RegenerateStatements(PrintParameters pars, List <DetailsResult> statements) { var process = PXGraph.CreateInstance <StatementCycleProcessBO>(); var cycle = process.CyclesList.SelectSingle(pars.StatementCycleId); var customerSelect = new PXSelect <Customer, Where <Customer.bAccountID, Equal <Required <DetailsResult.customerID> > > >(process); var customers = statements.Select(s => customerSelect.SelectSingle(s.CustomerID)).Where(c => c != null); if (cycle == null || customers == null || customers.Any() == false) { return; } StatementCycleProcessBO.RegenerateStatements(process, cycle, customers); }
private async void ExportMap_Click(object sender, RoutedEventArgs e) { try { progress.Visibility = Visibility.Visible; PrintParameters printParameters = new PrintParameters(MyMapView) { ExportOptions = new ExportOptions() { Dpi = 96, OutputSize = new Size(MyMapView.ActualWidth, MyMapView.ActualHeight) }, LayoutTemplate = (string)comboLayout.SelectedItem ?? string.Empty, Format = (string)comboFormat.SelectedItem, }; var result = await _printTask.SubmitPrintJobAsync(printParameters); while (result.JobStatus != GPJobStatus.Cancelled && result.JobStatus != GPJobStatus.Deleted && result.JobStatus != GPJobStatus.Succeeded && result.JobStatus != GPJobStatus.TimedOut) { result = await _printTask.CheckPrintJobStatusAsync(result.JobID); Console.WriteLine(string.Join(Environment.NewLine, result.Messages.Select(x => x.Description))); await Task.Delay(2000); } if (result.JobStatus == GPJobStatus.Succeeded) { MessageBox.Show(result.JobStatus.ToString() + " Job ID:" + result.JobID); var outParam = await _printTask.GetPrintJobResultAsync(result.JobID); if (outParam != null) { Process.Start(outParam.PrintResult.Uri.AbsoluteUri); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Sample Error"); } finally { progress.Visibility = Visibility.Collapsed; } }
protected virtual void PrintParameters_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { PrintParameters row = (PrintParameters)e.Row; if (row != null) { PrintParameters filter = (PrintParameters)this.Filter.Cache.CreateCopy(row); switch (row.Action) { case ActionTypes.Print: Details.SetProcessDelegate(list => Print(filter, list, false)); break; case ActionTypes.Email: Details.SetProcessDelegate(list => Email(filter, list, false)); break; case ActionTypes.MarkDontEmail: Details.SetProcessDelegate(list => Email(filter, list, true)); break; case ActionTypes.MarkDontPrint: Details.SetProcessDelegate(list => Print(filter, list, true)); break; case ActionTypes.Release: Details.SetProcessDelegate(list => Release(filter, list)); row.ShowAll = false; break; } PXUIFieldAttribute.SetEnabled <PrintParameters.showAll>(sender, row, row.Action != ActionTypes.Release); bool showPrintSettings = IsPrintingAllowed(row); PXUIFieldAttribute.SetVisible <PrintParameters.printWithDeviceHub>(sender, row, showPrintSettings); PXUIFieldAttribute.SetVisible <PrintParameters.definePrinterManually>(sender, row, showPrintSettings); PXUIFieldAttribute.SetVisible <PrintParameters.printerID>(sender, row, showPrintSettings); PXUIFieldAttribute.SetVisible <PrintParameters.numberOfCopies>(sender, row, showPrintSettings); PXUIFieldAttribute.SetEnabled <PrintParameters.definePrinterManually>(sender, row, row.PrintWithDeviceHub == true); PXUIFieldAttribute.SetEnabled <PrintParameters.numberOfCopies>(sender, row, row.PrintWithDeviceHub == true); PXUIFieldAttribute.SetEnabled <PrintParameters.printerID>(sender, row, row.PrintWithDeviceHub == true && row.DefinePrinterManually == true); if (row.PrintWithDeviceHub != true || row.DefinePrinterManually != true) { row.PrinterID = null; } } }
public string Print(PrintParameters modifier) { var builder = new StringBuilder(); var startTab = modifier.HasFlag(PrintParameters.NoStartTab) ? string.Empty : Constants.TabulationSymbol; if (!modifier.HasFlag(PrintParameters.NoComments)) { Comments.AppendComments(builder); } builder.Append(modifier.HasFlag(PrintParameters.AddQuotes) ? $"{startTab}\"{Model.Name}\"" : $"{startTab}{Model.Name}"); return(builder.ToString()); }
private void ExportMap_Click(object sender, RoutedEventArgs e) { if (printTask == null || Formats.SelectedIndex < 0 || printTask.IsBusy) { return; } PrintParameters printParameters = new PrintParameters(MyMap) { ExportOptions = new ExportOptions() { Dpi = 96, OutputSize = new Size(MyMap.ActualWidth, MyMap.ActualHeight) }, LayoutTemplate = (string)LayoutTemplates.SelectedItem ?? string.Empty, Format = (string)Formats.SelectedItem, }; printTask.ExecuteAsync(printParameters); }
public virtual IEnumerable NextStatementDate(PXAdapter adapter) { PrintParameters filter = this.Filter.Current; if (filter != null && !string.IsNullOrEmpty(filter.StatementCycleId)) { ARStatement statement = PXSelect <ARStatement, Where <ARStatement.statementCycleId, Equal <Required <ARStatement.statementCycleId> >, And < Where <ARStatement.statementDate, Greater <Required <ARStatement.statementDate> >, Or <Required <ARStatement.statementDate>, IsNull> > > >, OrderBy <Asc <ARStatement.statementDate> > > .Select(this, filter.StatementCycleId, filter.StatementDate, filter.StatementDate); if (statement != null) { filter.StatementDate = statement.StatementDate; } } Details.Cache.Clear(); return(adapter.Get()); }
public static void Print(PrintParameters filter, List <DetailsResult> list, bool markOnly) { ARDunningLetterUpdate graph = PXGraph.CreateInstance <ARDunningLetterUpdate>(); PXReportRequiredException ex = null; foreach (DetailsResult t in list) { int? L = t.DunningLetterID; ARDunningLetter doc = graph.DL.Select(L.Value); if (markOnly) { if (filter.ShowAll != true) { doc.DontPrint = true; graph.docs.Cache.Update(doc); } } else { Dictionary <string, string> d = new Dictionary <string, string>(); d["ARDunningLetter.DunningLetterID"] = L.ToString(); if (doc.Printed != true) { doc.Printed = true; graph.docs.Cache.Update(doc); } ex = PXReportRequiredException.CombineReport(ex, GetCustomerReportID(graph, "AR661000", t), d); } } graph.Save.Press(); if (ex != null) { throw ex; } }
// basic printing void _btnBasicPrint_Click(object sender, RoutedEventArgs e) { // get margins, scale mode var margin = _cmbMargins.SelectedIndex == 0 ? 96.0 / 4 : _cmbMargins.SelectedIndex == 1 ? 96.0 / 2 : 96.0; var scaleMode = _cmbZoom.SelectedIndex == 0 ? ScaleMode.ActualSize : _cmbZoom.SelectedIndex == 1 ? ScaleMode.PageWidth : ScaleMode.SinglePage; bool showPrintDialog = _chkShowPrintDialog.IsChecked.Value; if (_cmbOrientation.SelectedIndex > 0 || showPrintDialog) { // setup advanced print parameters according to user selection PrintParameters pp = new PrintParameters(); pp.Margin = new Thickness(margin); pp.ScaleMode = scaleMode; pp.MaxPages = 20; pp.ShowPrintDialog = showPrintDialog; if (_cmbOrientation.SelectedIndex > 0) { pp.PrintQueue = System.Printing.LocalPrintServer.GetDefaultPrintQueue(); pp.PrintTicket = pp.PrintQueue.DefaultPrintTicket; pp.PrintTicket.PageOrientation = _cmbOrientation.SelectedIndex == 1 ? System.Printing.PageOrientation.Portrait : System.Printing.PageOrientation.Landscape; } pp.DocumentName = "C1FlexGrid printing example"; // print the grid _flex.Print(pp); } else { // print the grid with default printing options and showing PrintDialog _flex.Print("C1FlexGrid printing example", scaleMode, new Thickness(margin), 20); } }
/// <summary> /// Generates a list of documents that meet the filter criteria. /// This list is used for display in the processing screen /// </summary> /// <returns>List of Dunning Letters</returns> protected virtual IEnumerable details() { Details.Cache.Clear(); PrintParameters header = Filter.Current; if (header == null) { yield break; } List <DetailsResult> results = new List <DetailsResult>(); PXSelectBase <ARDunningLetter> cmd = new PXSelectJoinGroupBy <ARDunningLetter, InnerJoin <ARDunningLetterDetail, On <ARDunningLetterDetail.dunningLetterID, Equal <ARDunningLetter.dunningLetterID> > >, Where <ARDunningLetter.dunningLetterDate, Between <Required <ARDunningLetter.dunningLetterDate>, Required <ARDunningLetter.dunningLetterDate> >, And <ARDunningLetter.consolidated, Equal <Required <ARDunningLetter.consolidated> > > >, Aggregate <GroupBy <ARDunningLetter.dunningLetterID, Sum <ARDunningLetterDetail.overdueBal> > >, OrderBy <Asc <ARDunningLetter.bAccountID> > >(this); if (Filter.Current.Action == ActionTypes.Release) { cmd.WhereAnd <Where <ARDunningLetter.released, Equal <False>, And <ARDunningLetter.voided, Equal <False> > > >(); } else { cmd.WhereAnd <Where <ARDunningLetter.released, Equal <True>, And <ARDunningLetter.voided, Equal <False> > > >(); } foreach (PXResult <ARDunningLetter, ARDunningLetterDetail> res in cmd.Select(header.BeginDate, header.EndDate, this.Consolidated)) { ARDunningLetter dunningLetter = res; ARDunningLetterDetail detailSum = res; if (Filter.Current.Action == ActionTypes.Print && header.ShowAll == false && (dunningLetter.DontPrint == true || dunningLetter.Printed == true)) { continue; } if (Filter.Current.Action == ActionTypes.Email && header.ShowAll == false && (dunningLetter.DontEmail == true || dunningLetter.Emailed == true)) { continue; } if (Filter.Current.Action == ActionTypes.MarkDontEmail && header.ShowAll == false && (dunningLetter.DontEmail == true || dunningLetter.Emailed == true)) { continue; } DetailsResult row = new DetailsResult(); row.BranchID = dunningLetter.BranchID; row.CustomerId = dunningLetter.BAccountID; row.DunningLetterID = dunningLetter.DunningLetterID; row.DunningLetterDate = dunningLetter.DunningLetterDate; row.DunningLetterLevel = dunningLetter.DunningLetterLevel; row.LastLevel = dunningLetter.LastLevel; row.DontEmail = dunningLetter.DontEmail; row.DontPrint = dunningLetter.DontPrint; row.Emailed = dunningLetter.Emailed; row.Printed = dunningLetter.Printed; row.DocBal = detailSum.OverdueBal; results.Add(row); } foreach (DetailsResult item in results) { Details.Cache.SetStatus(item, PXEntryStatus.Held); yield return(item); } Details.Cache.IsDirty = false; }
/// <summary> /// Executes or submit print job to ArcGIS server or displays print preview when ArcGIS server printing is not used. /// </summary> private void OnPrint(object commandParameter) { if (!CanPrint(commandParameter)) return; CheckLayerSupport(); IsBusy = true; Status = Resources.Strings.PrintStarted; if (PrintWithArcGISServer) { IsPrinting = true; var printParameters = new PrintParameters(map) { Format = Format, LayoutTemplate = LayoutTemplate, LayoutOptions = new LayoutOptions() { Title = Title, AuthorText = Author, Copyright = CopyrightText }, MapOptions = new MapOptions(map) { Scale = UseScale ? MapScale : double.NaN }, ExportOptions = new ExportOptions() { Dpi = Dpi } }; if (LayoutTemplate == "MAP_ONLY") printParameters.ExportOptions.OutputSize = new Size(map.ActualWidth, map.ActualHeight); try { // Turns off layer's visibility for layers that are not supported // to avoid exception thrown during map serialization. UpdateLayersNotSupported(false); // Hide basemap layers from legend so they are excluded from the print legend ToggleBasemapLegend(false); // Initialize layers with default legend labels InitializeLegendLabels(); if (IsServiceAsynchronous) printTask.SubmitJobAsync(printParameters); else printTask.ExecuteAsync(printParameters); // Toggle visibility for layers that are not supported in printing back on UpdateLayersNotSupported(true); // Turn legend for basemap layers back on ToggleBasemapLegend(true); } catch (Exception ex) { Error = ex; IsBusy = false; // Turns on layer's visibility for layers that are not supported. UpdateLayersNotSupported(true); } } else { Status = Resources.Strings.GetPrintLayoutXamlStarted; var layoutXamlWebClient = new WebClient(); layoutXamlWebClient.DownloadStringCompleted += LayoutXamlWebClient_DownloadStringCompleted; layoutXamlWebClient.DownloadStringAsync(new Uri(new Uri(MapApplication.Current.Urls.BaseUrl), PrintLayout.XamlFilePath)); } }
public void StartTerminalPrint() { parameter = ParametersService.GetPrintParameters(); _vimApi.StartTerminalPrint(parameter, this); }
private void ExportMapButton_Click(object sender, System.Windows.RoutedEventArgs e) { this.IsBusy = true; linkExportResult.Visibility = System.Windows.Visibility.Collapsed; PrintParameters printParams = new PrintParameters(this.MapControl); printParams.Format = (string)boxExportFormats.SelectedItem; ExportOptions expOptions = new ExportOptions() { Dpi = 96 }; expOptions.OutputSize = new Size(this.MapControl.ActualWidth, this.MapControl.ActualHeight); LegendOptions legendOptions = new LegendOptions(); List <LegendLayer> legendLayers = new List <LegendLayer>(); foreach (LivingMapLayer layer in this.AppConfig.MapConfig.LivingMaps) { if (this.MapControl.Layers[layer.ID] is ArcGISDynamicMapServiceLayer) { int[] visibleLayers = (this.MapControl.Layers[layer.ID] as ArcGISDynamicMapServiceLayer).VisibleLayers; List <object> layerIDs = new List <object>(); foreach (int lyrID in visibleLayers) { layerIDs.Add(lyrID); } legendLayers.Add(new LegendLayer() { LayerId = layer.ID, SubLayerIds = layerIDs }); } else { legendLayers.Add(new LegendLayer() { LayerId = layer.ID }); } } legendOptions.LegendLayers = legendLayers; ScaleBarOptions scaleOptions = new ScaleBarOptions(); string metricUnits = (boxMetricUnits.SelectedItem as ComboBoxItem).Content as string; string nonmetricUnits = (boxNonmetricUnits.SelectedItem as ComboBoxItem).Content as string; scaleOptions.MetricUnit = (ScaleBarOptions.MetricUnits)Enum.Parse(typeof(ScaleBarOptions.MetricUnits), metricUnits, true); scaleOptions.MetricLabel = txtMetricLabel.Text; scaleOptions.NonMetricUnit = (ScaleBarOptions.NonMetricUnits)Enum.Parse(typeof(ScaleBarOptions.NonMetricUnits), nonmetricUnits, true); scaleOptions.NonMetricLabel = txtNonmetricLabel.Text; LayoutOptions layoutOptions = new LayoutOptions() { LegendOptions = legendOptions, ScaleBarOptions = scaleOptions }; layoutOptions.Title = txtExportMapTitle.Text; layoutOptions.Copyright = txtCopyright.Text; printParams.ExportOptions = expOptions; printParams.LayoutOptions = layoutOptions; printParams.LayoutTemplate = (string)boxLayoutTemplates.SelectedItem; if (isAsynPrintService) { printTask.SubmitJobAsync(printParams); } else { printTask.ExecuteAsync(printParams); } }
/// <summary> /// This method is used for Insert PosBill related data at the time of Payment. /// </summary> private void InsertPOSBillData() { try { var accountingEntries = new List <DomainModel.Models.Accounting.DoubleEntry>(); printParameters = new PrintParameters(); //Get the total bill count of current date. string billNumber = ""; //SettingHelpers.CompanyConfigruationObject.InvoiceNo + DateTime.UtcNow.ToString("dd/mm/yyyy") + "0001"; var billCountResponse = _posRepository.GetTotalBillDataByBillDate(); if (billCountResponse < 9) { billNumber = SettingHelpers.CompanyConfigruationObject.InvoiceNo + DateTime.UtcNow.ToString("dd/MM/yy") + "000" + (billCountResponse + 1); } else if (billCountResponse < 99) { billNumber = SettingHelpers.CompanyConfigruationObject.InvoiceNo + DateTime.UtcNow.ToString("dd/MM/yy") + "00" + (billCountResponse + 1); } else if (billCountResponse < 999) { billNumber = SettingHelpers.CompanyConfigruationObject.InvoiceNo + DateTime.UtcNow.ToString("dd/MM/yy") + "0" + (billCountResponse + 1); } else if (billCountResponse < 9999) { billNumber = SettingHelpers.CompanyConfigruationObject.InvoiceNo + DateTime.UtcNow.ToString("dd/MM/yy") + (billCountResponse + 1); } else { billNumber = SettingHelpers.CompanyConfigruationObject.InvoiceNo + DateTime.UtcNow.ToString("dd/MM/yy") + (billCountResponse + 1); } POSBill posBill = new POSBill(); posBill.POSSessionID = SettingHelpers.CurrentPosSessionId; posBill.UserID = SettingHelpers.CurrentUserId; posBill.BranchID = SettingHelpers.CurrentBranchId; if (customerInfo == null || customerInfo.Customer.Id == 0 || customerInfo.Customer.Id == 1) { printParameters.IsCustomer = false; posBill.CustomerID = 1; } else { posBill.CustomerID = customerInfo.Customer.Id; printParameters.IsCustomer = true; } posBill.BillDate = DateTime.UtcNow; posBill.TotalAmount = TotalAmount; posBill.BillNo = billNumber.Replace("/", "").Replace("-", ""); posBill.CreatedDateTime = DateTime.UtcNow.Date; var billDetail = _posRepository.InsertPosBillData(posBill); if (billDetail != null) { accountingEntries.Add(new DoubleEntry { Description = "POS Sale Entry Bill No:" + posBill.BillNo, LedgerId = SettingHelpers.Ledgers.First(x => x.Name == StringConstants.Sales).Id, ActivityName = StringConstants.PosSale, Debit = 0, Credit = TotalAmount + discount, CreatedDateTime = DateTime.UtcNow, TransactionDate = DateTime.UtcNow }); _posRepository.InsertPosBillItemsData(_itemProfileCollection.ToList(), billDetail.Id); if (!String.IsNullOrEmpty(CashAmount)) { accountingEntries.Add(new DoubleEntry { Description = "POS Sale by cash Entry Bill No:" + posBill.BillNo, LedgerId = SettingHelpers.Ledgers.First(x => x.Name == StringConstants.CashInHand).Id, ActivityName = StringConstants.PosSale, Debit = Convert.ToDecimal(CashAmount), Credit = 0, CreatedDateTime = DateTime.UtcNow, TransactionDate = DateTime.UtcNow }); InsertPosBillPaymentData(billDetail.Id, POSBillPaymentType.Cash, string.Empty, Convert.ToDecimal(CashAmount)); } if (!String.IsNullOrEmpty(DebitCardAmount)) { accountingEntries.Add(new DoubleEntry { Description = "POS Sale by Debit Card Entry Bill No:" + posBill.BillNo, LedgerId = SettingHelpers.Ledgers.First(x => x.Name == StringConstants.Bank).Id, ActivityName = StringConstants.PosSale, Debit = Convert.ToDecimal(DebitCardAmount), Credit = 0, CreatedDateTime = DateTime.UtcNow, TransactionDate = DateTime.UtcNow }); InsertPosBillPaymentData(billDetail.Id, POSBillPaymentType.DebitCard, DebitCardReceiptNo, Convert.ToDecimal(DebitCardAmount)); } if (!String.IsNullOrEmpty(CreditCardAmount)) { accountingEntries.Add(new DoubleEntry { Description = "POS Sale by Credit Card Entry Bill No:" + posBill.BillNo, LedgerId = SettingHelpers.Ledgers.First(x => x.Name == StringConstants.Bank).Id, ActivityName = StringConstants.PosSale, Debit = Convert.ToDecimal(CreditCardAmount), Credit = 0, CreatedDateTime = DateTime.UtcNow, TransactionDate = DateTime.UtcNow }); InsertPosBillPaymentData(billDetail.Id, POSBillPaymentType.CreditCard, CreditCardReceiptNumber, Convert.ToDecimal(CreditCardAmount)); } if (!String.IsNullOrEmpty(CouponAmount)) { accountingEntries.Add(new DoubleEntry { Description = "POS Sale by Coupan Entry Bill No:" + posBill.BillNo, LedgerId = SettingHelpers.Ledgers.First(x => x.Name == StringConstants.Expenses).Id, ActivityName = StringConstants.PosSale, Debit = Convert.ToDecimal(CouponAmount), Credit = 0, CreatedDateTime = DateTime.UtcNow, TransactionDate = DateTime.UtcNow }); InsertPosBillPaymentData(billDetail.Id, POSBillPaymentType.Coupon, CouponNo, Convert.ToDecimal(CouponAmount)); } if (!String.IsNullOrEmpty(chequeAmount)) { accountingEntries.Add(new DoubleEntry { Description = "POS Sale by Cheque Entry Bill No:" + posBill.BillNo, LedgerId = SettingHelpers.Ledgers.First(x => x.Name == StringConstants.Bank).Id, ActivityName = StringConstants.PosSale, Debit = Convert.ToDecimal(chequeAmount), Credit = 0, CreatedDateTime = DateTime.UtcNow, TransactionDate = DateTime.UtcNow }); InsertPosBillPaymentData(billDetail.Id, POSBillPaymentType.Cheque, ChequeNo, Convert.ToDecimal(chequeAmount)); } if (!String.IsNullOrEmpty(CreditAccountAmount)) { //TODO: Customer Ledger InsertPosBillPaymentData(billDetail.Id, POSBillPaymentType.CreditAccount, string.Empty, Convert.ToDecimal(CreditAccountAmount)); } if (!String.IsNullOrEmpty(DownPaymentAmount)) { InsertPosBillPaymentData(billDetail.Id, POSBillPaymentType.DownPayment, string.Empty, Convert.ToDecimal(DownPaymentAmount)); } //If Bill process for Customer PO then update Customer PO is collected in CustomerPruchaseOrder table. if (SettingHelpers.IsCustomerPO) { //update CPO bill var cpoObj = new CustomerPurchaseOrder { PurchaseOrderNo = customerInfo.CPO.PurchaseOrderNo, IsCollected = true }; var httpClient = new HttpClients(); var jsonCPO = JsonConvert.SerializeObject(cpoObj); var httpContentCpo = new StringContent(jsonCPO, Encoding.UTF8, "application/json"); var responseCustomerPO = httpClient.PostAsync("api/customerpo/updatecustomerpurchseorderforpos", httpContentCpo); if (responseCustomerPO.IsSuccessStatusCode) { var resultCpo = responseCustomerPO.Content.ReadAsAsync <int>().Result; //add CPO Bill mapping var cpoBill = new CPOBill(); cpoBill.CPOId = resultCpo; cpoBill.POSBillId = billDetail.Id; jsonCPO = JsonConvert.SerializeObject(cpoBill); httpContentCpo = new StringContent(jsonCPO, Encoding.UTF8, "application/json"); var responseCpoBill = httpClient.PostAsync("api/customerpo/addcpobillforpos", httpContentCpo); if (responseCpoBill.IsSuccessStatusCode) { resultCpo = responseCpoBill.Content.ReadAsAsync <int>().Result; } } printParameters.IsCpo = true; printParameters.DownPayment = DownPaymentAmount; printParameters.AdditionalCost = AdditionalCost; printParameters.CpoNumber = cpoObj.PurchaseOrderNo; } // if bill process for Return Bill then updat the ReturnBill table for process successfully. if (customerInfo.ReturnBill != null) { UpdateReuturnBill(); printParameters.IsReturnBill = true; printParameters.ReturnBillNo = customerInfo.ReturnBill.ReturnedBillNo; printParameters.Substitute = customerInfo.ReturnBill.SubstituteItemsAmount; printParameters.ReturnAmount = customerInfo.ReturnBill.ReturnedCash; if (RemainingAmount != 0) { accountingEntries.Add(new DoubleEntry { Description = "POS Sale cash return Bill No:" + customerInfo.ReturnBill.ReturnedBillNo, LedgerId = SettingHelpers.Ledgers.First(x => x.Name == StringConstants.CashInHand).Id, ActivityName = StringConstants.PosSale, Debit = 0, Credit = RemainingAmount, CreatedDateTime = DateTime.UtcNow, TransactionDate = DateTime.UtcNow }); } } } if (discount > 0) { accountingEntries.Add(new DoubleEntry { Description = "POS Sale Discount Bill No:" + printParameters.InvoiceNo, LedgerId = SettingHelpers.Ledgers.First(x => x.Name == StringConstants.Expenses).Id, ActivityName = StringConstants.PosSale, Debit = discount, Credit = 0, CreatedDateTime = DateTime.UtcNow, TransactionDate = DateTime.UtcNow }); } #region "Set Print Parameters" printParameters.Tax = 0; printParameters.Cash = PaidAmount.Value; printParameters.CashReturn = RemainingAmount; printParameters.Customer = customerInfo.Customer; printParameters.Items = _itemProfileCollection.ToList(); printParameters.TotalQuantity = _itemProfileCollection.Sum(x => x.ItemQuantity); printParameters.TotalAmount = posBill.TotalAmount + printParameters.Substitute; printParameters.Discount = discount; printParameters.InvoiceNo = posBill.BillNo; printParameters.SDateTime = DateTime.UtcNow.ToString("dd-MM-yy hh:mm:ss"); #endregion _posRepository.AddAccountingEntries(accountingEntries); } catch (Exception) { throw; } }