Why for an online store, you ask? Of course, for the online store and not only I answer. Typically, trading large trading companies do not write software for themselves, they order it on the side. And no matter how strange it may seem, very often they don’t even reach the price tag, and this document plays a significant role in trade. I remember the times when the finalization of the price tag was 150 euros and then, this task did not seem trivial at all. At the end of the article is attached the working
project c #, #core, # .net #MVC. Try experimenting with your trading system, thanks everyone in advance for the positive feedback.
So, the owner of an online store (regular store) decided to modify his boring black and white price tags. And what do we have in stock, you ask?

')
In my previous
article , a sea of complaints caused an xml data source. It seemed to me obvious that experienced programmers could easily adapt the considered example to other sources, however, as the comments showed, this turned out to be wrong. Therefore, we will pay a little attention to the data set. We will use the universal component DataSet, I hope that it can be filled in this way or the reader can replace it with another source
Consider the controller
public class HomeController : MyController { private IHostingEnvironment _env; public HomeController(IHostingEnvironment env) { _env = env; } public IActionResult Index() { ViewBag.Items = InitData().Tables["Items"].Rows; return View(); } public IActionResult PrintTags() { WebReport webReport = new WebReport(); webReport.Width = "100%"; DataSet d = InitData(); webReport.Report.Load(System.IO.Path.Combine(_env.WebRootPath + "/reports", "tags.frx")); webReport.Report.RegisterData(d, "ItemsDataSet"); webReport.Report.GetDataSource("Items").Enabled = true; (webReport.Report.FindObject("Data1") as DataBand).DataSource = webReport.Report.GetDataSource("Items"); webReport.Report.Prepare(); ViewBag.WebReport = webReport; return View(); } }
It is an inheritor of the MyController class in which the data set is initialized. This is done solely in order not to overload the code of the main controller. The Index page displays the storefront. The PrintTags page provides the formation of price tags.
So, after the data for the price tag have been prepared, we will load the
FastReport demo version and develop the price tag design

The design is completely spontaneous, you can type any components for your tasks, be it bar codes or even drawings. The template file is located in the project in
wwwroot / reports / tags.frx, you can fix it or create your own price tag or label depending on where the print will be displayed. It may even be adhesive tape and printed on a thermal label.
When creating a project, be sure to add links to the packages.


In Setup.cs add
app.UseFastReport();
In controllers
using FastReport; using FastReport.Web;
All this can be viewed in the
project.Printing price tags is launched by the button Print Tags
public IActionResult PrintTags() { WebReport webReport = new WebReport();
Go to the page by button Print Tags

Then you can immediately print or download the file in PDF format.

Typing

Or download and send by mail.
Conclusion
Without a doubt, specialized tools can work wonders. The component that is able to create such reports will be useful to any company working with information systems of the ERP class. I saw on the tube companies that work in programs where all reports are made outside the main system in order to reduce the costs of their production. I would be grateful for constructive reviews, all the success in building reports.