private void mnuPrint_Click(object sender, EventArgs e) { try { if (DGrid.RowCount <= 0 || DGrid.CurrentRow == null) { return; } var guid = (Guid)DGrid[dgGuid.Index, DGrid.CurrentRow.Index].Value; var order = OrderBussines.Get(guid); if (order == null) { return; } var reportList = new List <OrderReportBussines>(); foreach (var item in order.DetList) { reportList.Add(new OrderReportBussines() { CompanyName = "گروه فنی و مهندسی آراد", CompanyTell = "09382420272", ContractCode = order.ContractCode, CustomerAddress = order.Customer?.Address, CustomerName = order.CustomerName, CustomerSerialNumber = order.Customer?.AppSerial, CustomerTell = order.Customer?.Tell1, DateSh = order.DateSh, OdrerDiscount = order.Discount, OrderSum = order.Sum, OrderTotal = order.Total, OrderUserName = order.UserName, ProductCount = item.Count, ProductDiscount = item.Discount, ProductName = item.ProductName, ProductPrice = item.Price, ProductTotal = item.Total, Time = order.Date.ToShortTimeString(), OrderTotalName = $"{NumberToString.Num2Str(order.Total.ToString().ParseToDouble().ToString())} ریال" }); } var cls = new ReportGenerator(StiType.DepartmentOrder, EnPrintType.Pdf_A4) { Lst = new List <object>(reportList?.OrderBy(q => q.ProductName)) }; cls.PrintNew(); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
private async void mnuPrintList_Click(object sender, EventArgs e) { try { if (DGrid.RowCount <= 0) { return; } if (DGrid.CurrentRow == null) { return; } var frm = new frmSetPrintSize(false); if (frm.ShowDialog(this) != DialogResult.OK) { return; } _token?.Cancel(); _token = new CancellationTokenSource(); var pardakht = await PardakhtBussines.GetAllAsync(_token.Token); var list = new List <OperationListPrintViewModel>(); foreach (var item in pardakht) { var totalSum = pardakht.Sum(q => q.SumCheckMoshtari) + pardakht.Sum(q => q.SumHavale) + pardakht.Sum(q => q.SumNaqd) + pardakht.Sum(q => q.SumCheckShakhsi); list.Add(new OperationListPrintViewModel() { PrintDateSh = Calendar.MiladiToShamsi(DateTime.Now), PrintTime = DateTime.Now.ToShortTimeString(), DateM = item.DateM, Count = pardakht.Count, Description = item.Description, Number = item.Number, Check = 0, DateSh = item.DateSh, TafsilName = item.TafsilName, Havale = 0, Naqd = 0, TotalRow = item.Sum, TotalSum = totalSum, TotalHorouf = $"{NumberToString.Num2Str(totalSum.ToString())} ریال" }); } list = list?.OrderBy(q => q.DateM)?.ToList(); if (frm._PrintType == EnPrintType.Excel) { return; } var cls = new ReportGenerator(StiType.Pardakht_List, frm._PrintType) { Lst = new List <object>(list) }; cls.PrintNew(); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }