Advertisement
Guest User

Untitled

a guest
Aug 31st, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. private void btnPrntDetail_Click(object sender, System.EventArgs args)
  2. {
  3. if (edvEnd.Row > -1)
  4. {
  5. // Set status
  6. oTrans.PushStatusText("Production Detail Report Submitting..",true);
  7.  
  8. // Create report object
  9. Session otSession = (Session)oTrans.Session;
  10. JobProdDtl jobproddtl = new JobProdDtl(otSession.ConnectionPool);
  11. JobProdDtlDataSet dsjobproddtl = jobproddtl.GetNewParameters();
  12.  
  13. // Set filters
  14. dsjobproddtl.JobProdDtlParam[0].JobList = edvJobHead.dataView[edvJobHead.Row]["JobNum"].ToString();
  15. dsjobproddtl.JobProdDtlParam[0].AsmList = "";
  16. dsjobproddtl.JobProdDtlParam[0].MaterialTrans = true;
  17. dsjobproddtl.JobProdDtlParam[0].LaborTrans = true;
  18. dsjobproddtl.JobProdDtlParam[0].PrintProfit = true;
  19. dsjobproddtl.JobProdDtlParam[0].AllowJobProfitability = true;
  20.  
  21. // Prep generic values
  22. PrepPrintJob(dsjobproddtl, otSession, true);
  23.  
  24. // Print and clean
  25. jobproddtl.SubmitToAgent(dsjobproddtl, "SystemTaskAgent", 0, 0, "Epicor.Mfg.UIRpt.JobProdDtl");
  26. jobproddtl = null;
  27.  
  28. // Default status
  29. oTrans.PushStatusText("Ready",false);
  30. }
  31. }
  32.  
  33. // Paste in customization as is no changes
  34. private void PrepPrintJob(DataSet ds, Session otSession, bool prntDefaults)
  35. {
  36. // Provide print dialog support
  37. PrintDialog printDialog = new PrintDialog();
  38. if(!prntDefaults)
  39. {
  40. if (printDialog.ShowDialog() != DialogResult.OK)
  41. {
  42. throw new Exception("Printing canceled");
  43. }
  44. }
  45.  
  46. // Params that need setting
  47. ds.Tables[0].Rows[0]["AutoAction"] = "Print";
  48. ds.Tables[0].Rows[0]["AgentID"] = "SystemTaskAgent";
  49. ds.Tables[0].Rows[0]["DateFormat"] = "m/d/yyyy";
  50. ds.Tables[0].Rows[0]["NumericFormat"] = ",.";
  51.  
  52. // Print Params
  53. ds.Tables[0].Rows[0]["PrinterName"] = printDialog.PrinterSettings.PrinterName;
  54. ds.Tables[0].Rows[0]["RptPageSettings"] = Epicor.Mfg.Lib.Report.EpiPageAndPrinterSettings.CreatePageSettingsAsString(printDialog.PrinterSettings.DefaultPageSettings);
  55. ds.Tables[0].Rows[0]["RptPrinterSettings"] = Epicor.Mfg.Lib.Report.EpiPageAndPrinterSettings.CreatePrinterSettingsAsString(printDialog.PrinterSettings);
  56. ds.Tables[0].Rows[0]["WorkstationID"] = Epicor.Mfg.Lib.Report.EpiReportFunctions.GetWorkStationID(otSession);
  57. ds.Tables[0].Rows[0]["ReportCultureCode"] = Epicor.Mfg.Lib.Report.EpiReportFunctions.GetRptCultureCode(otSession);
  58. ds.Tables[0].Rows[0]["ReportCurrencyCode"] = Epicor.Mfg.Lib.Report.EpiReportFunctions.GetRptCurrencyCode(ds.Tables[0].Rows[0]["ReportCultureCode"].ToString(), otSession);
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement