صورتحساب @* @using Front.Services @using Shared.DTOs @using Stimulsoft.Base @using Stimulsoft.Report @using Stimulsoft.Report.Blazor @inject Fixedvalues fv; @inject HttpClientController hc; @layout EmptyLayout *@ @page "/InvoiceReport/{InvoiceID:int}" @* *@ @code { // public CompanyDTO? company { get; set; } // private StiReport Report; // [Parameter] public int InvoiceID { get; set; } // private int[] NoArray = default; // private int[] ItemArray = new int[] { 1011, 1012 }; // private string[] ItemNArray = new string[] { "کالا 1", "کالا 2" }; // private int[] amArray = new int[] { 1, 2 }; // private string[] UnitNArray = new string[] { "1011", "1012" }; // private string[] feeArray = new string[] { "کالا 1", "کالا 2" }; // private string[] prdisArray = new string[] { "", "" }; // private string[] disArray = new string[] { "1011", "1012" }; // private string[] adisArray = new string[] { "کالا 1", "کالا 2" }; // private string[] vamArray = new string[] { " 1, 2" }; // private string[] tsstamArray = new string[] { "1011", "1012" }; // private string[] vraArray = new string[] { "کالا 1", "کالا 2" }; // protected async override Task OnParametersSetAsync() // { // if (fv.invoice==null) // { // hc._nav.NavigateTo($"InvoiceDetails/{InvoiceID}"); // } // string CustomerName = ""; // string CustomerEconomicCode = ""; // string CustomerPhone = ""; // string CompanyName = ""; // string CompanyEconomicCode = ""; // string CompanyPhone = ""; // var cus =await GetCus(); // if (cus!=null) // { // CustomerName = cus?.FullName; // CustomerEconomicCode = cus?.EconomicCode; // CustomerPhone = cus?.Phone; // } // var company =await GetCompany(); // if (company != null) // { // CompanyName = company?.Name; // CompanyEconomicCode = company?.EconomicCode; // CompanyPhone = company?.Phone; // } // //datasource // NoArray = Enumerable // .Repeat(1, (int)((fv.invoice.items.Count() - 1) / 1) + 1) // .Select((tr, ti) => Convert.ToInt32(tr + (1 * ti))) // .ToArray(); // ItemArray = fv.invoice.items.Select(s => s.CODID).ToArray(); // ItemNArray = fv.invoice.items.Select(s => s.sstt).ToArray(); // amArray = fv.invoice.items.Select(s => Convert.ToInt32(s.am)).ToArray(); // UnitNArray= fv.invoice.items.Select(s => s.mu).ToArray(); // feeArray = fv.invoice.items.Select(s => s.fee.ToString("N0")).ToArray(); // prdisArray = fv.invoice.items.Select(s => s.prdis?.ToString("N0")).ToArray(); // disArray = fv.invoice.items.Select(s => s.dis?.ToString("N0")).ToArray(); // adisArray = fv.invoice.items.Select(s => s.adis?.ToString("N0")).ToArray(); // vamArray = fv.invoice.items.Select(s => s.vam?.ToString("N0")).ToArray(); // tsstamArray = fv.invoice.items.Select(s => s.tsstam?.ToString("N0")).ToArray(); // vraArray = fv.invoice.items.Select(s => s.vra?.ToString("N0")).ToArray(); // // //How to activate // // Stimulsoft.Base.StiLicense.Key = // // "6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn0s4gy0Fr5YoUZ9V00Y0igCSFQzwEqYBh/N77k" + // // "4f0fWXTHW5rqeBNLkaurJDenJ9o97TyqHs9HfvINK18Uwzsc/bG01Rq+x3H3Rf+g7AY92gvWmp7VA2Ux" + // // "a30Q97f61siWz2dE5kdBVcCnSFzC6awE74JzDcJMj8OuxplqB1CYcpoPcOjKy1PiATlC3UsBaLEXsok1" + // // "xxtRMQ283r282tkh8XQitsxtTczAJBxijuJNfziYhci2jResWXK51ygOOEbVAxmpflujkJ8oEVHkOA/C" + // // "jX6bGx05pNZ6oSIu9H8deF94MyqIwcdeirCe60GbIQByQtLimfxbIZnO35X3fs/94av0ODfELqrQEpLr" + // // "pU6FNeHttvlMc5UVrT4K+8lPbqR8Hq0PFWmFrbVIYSi7tAVFMMe2D1C59NWyLu3AkrD3No7YhLVh7LV0" + // // "Tttr/8FrcZ8xirBPcMZCIGrRIesrHxOsZH2V8t/t0GXCnLLAWX+TNvdNXkB8cF2y9ZXf1enI064yE5dw" + // // "Ms2fQ0yOUG/xornE"; // //var licenseStream = await Http.GetStreamAsync("Secret/license.key"); // //Stimulsoft.Base.StiLicense.LoadFromStream(licenseStream); // //Create empty report object // this.Report = new StiReport(); // //Load report template // var reportBytes = await hc._hc.GetByteArrayAsync($"Invoice/GetReport/{InvoiceID}"); // //Set value // Report["InvoiceID"] = fv.invoice?.ID; // Report["invoicedate"] = fv.invoice?.InvoiceDate; // Report["CusName"] = CustomerName; // Report["CusEconomicCode"] = CustomerEconomicCode; // Report["CusPhone"] = CustomerPhone; // Report["CompanyName"] = CompanyName; // Report["CompanyEconomicCode"] = CompanyEconomicCode; // Report["CompanyPhone"] = CompanyPhone; // // var rspCustomer = await hc.Get($"Customer/GetCustomer/{fv.invoice?.CustomerID}"); // // if (rspCustomer.IsSuccessStatusCode) // // Cus = await rspCustomer.Content.ReadFromJsonAsync(); // // var rspCompany = await hc.Get($"Company/GetCompany"); // // if (rspCompany.IsSuccessStatusCode) // // company = await rspCompany.Content.ReadFromJsonAsync(); // // Report["cusname"] = CustomerName; // this.Report.Load(reportBytes); // //Create User Data // var stiUserData1 = new Stimulsoft.Report.Dictionary.StiUserData(); // stiUserData1.Columns.AddRange(new Stimulsoft.Report.Dictionary.StiDataColumn[] { // new Stimulsoft.Report.Dictionary.StiDataColumn("No", "No", "No", typeof(int), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("Item", "Item", "Item", typeof(int), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("ItemN", "ItemN", "ItemN", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("am", "am", "am", typeof(int), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("UnitN", "UnitN", "UnitN", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("fee", "fee", "fee", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("prdis", "prdis", "prdis", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("dis", "dis", "dis", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("adis", "adis", "adis", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("vam", "vam", "vam", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("tsstam", "tsstam", "tsstam", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("vra", "vra", "vra", typeof(string), null) // }); // stiUserData1.Count = fv.invoice.items.Count(); // stiUserData1.GetData += new Stimulsoft.Report.Dictionary.StiUserGetDataEventHandler(stiUserData1_GetData); // //Register new data in the report template // this.Report.RegData("Items", stiUserData1); // await base.OnParametersSetAsync(); // } // private void stiUserData1_GetData(object sender, Stimulsoft.Report.Dictionary.StiUserGetDataEventArgs e) // { // if (e.ColumnName == "No") e.Data = NoArray[e.Position]; // if (e.ColumnName == "Item") e.Data = ItemArray[e.Position]; // if (e.ColumnName == "ItemN") e.Data = ItemNArray[e.Position]; // if (e.ColumnName == "am") e.Data = amArray[e.Position]; // if (e.ColumnName == "UnitN") e.Data = UnitNArray[e.Position]; // if (e.ColumnName == "fee") e.Data = feeArray[e.Position]; // if (e.ColumnName == "prdis") e.Data = prdisArray[e.Position]; // if (e.ColumnName == "dis") e.Data = disArray[e.Position]; // if (e.ColumnName == "adis") e.Data = adisArray[e.Position]; // if (e.ColumnName == "vam") e.Data = vamArray[e.Position]; // if (e.ColumnName == "tsstam") e.Data = tsstamArray[e.Position]; // if (e.ColumnName == "vra") e.Data = vraArray[e.Position]; // } } @functions{ // private async Task GetCus() // { // var rspCustomer = await hc.Get($"Customer/GetCustomer/{fv.invoice?.CustomerID}"); // if (rspCustomer.IsSuccessStatusCode) // return await rspCustomer.Content.ReadFromJsonAsync(); // else return null; // } // private async Task GetCompany() // { // var rspCompany = await hc.Get($"Company/GetCompany"); // if (rspCompany.IsSuccessStatusCode) // return await rspCompany.Content.ReadFromJsonAsync(); // else return null; // } }