Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void btnPrntDetail_Click(object sender, System.EventArgs args)
- {
- if (edvEnd.Row > -1)
- {
- // Set status
- oTrans.PushStatusText("Production Detail Report Submitting..",true);
- // Create report object
- Session otSession = (Session)oTrans.Session;
- JobProdDtl jobproddtl = new JobProdDtl(otSession.ConnectionPool);
- JobProdDtlDataSet dsjobproddtl = jobproddtl.GetNewParameters();
- // Set filters
- dsjobproddtl.JobProdDtlParam[0].JobList = edvJobHead.dataView[edvJobHead.Row]["JobNum"].ToString();
- dsjobproddtl.JobProdDtlParam[0].AsmList = "";
- dsjobproddtl.JobProdDtlParam[0].MaterialTrans = true;
- dsjobproddtl.JobProdDtlParam[0].LaborTrans = true;
- dsjobproddtl.JobProdDtlParam[0].PrintProfit = true;
- dsjobproddtl.JobProdDtlParam[0].AllowJobProfitability = true;
- // Prep generic values
- PrepPrintJob(dsjobproddtl, otSession, true);
- // Print and clean
- jobproddtl.SubmitToAgent(dsjobproddtl, "SystemTaskAgent", 0, 0, "Epicor.Mfg.UIRpt.JobProdDtl");
- jobproddtl = null;
- // Default status
- oTrans.PushStatusText("Ready",false);
- }
- }
- // Paste in customization as is no changes
- private void PrepPrintJob(DataSet ds, Session otSession, bool prntDefaults)
- {
- // Provide print dialog support
- PrintDialog printDialog = new PrintDialog();
- if(!prntDefaults)
- {
- if (printDialog.ShowDialog() != DialogResult.OK)
- {
- throw new Exception("Printing canceled");
- }
- }
- // Params that need setting
- ds.Tables[0].Rows[0]["AutoAction"] = "Print";
- ds.Tables[0].Rows[0]["AgentID"] = "SystemTaskAgent";
- ds.Tables[0].Rows[0]["DateFormat"] = "m/d/yyyy";
- ds.Tables[0].Rows[0]["NumericFormat"] = ",.";
- // Print Params
- ds.Tables[0].Rows[0]["PrinterName"] = printDialog.PrinterSettings.PrinterName;
- ds.Tables[0].Rows[0]["RptPageSettings"] = Epicor.Mfg.Lib.Report.EpiPageAndPrinterSettings.CreatePageSettingsAsString(printDialog.PrinterSettings.DefaultPageSettings);
- ds.Tables[0].Rows[0]["RptPrinterSettings"] = Epicor.Mfg.Lib.Report.EpiPageAndPrinterSettings.CreatePrinterSettingsAsString(printDialog.PrinterSettings);
- ds.Tables[0].Rows[0]["WorkstationID"] = Epicor.Mfg.Lib.Report.EpiReportFunctions.GetWorkStationID(otSession);
- ds.Tables[0].Rows[0]["ReportCultureCode"] = Epicor.Mfg.Lib.Report.EpiReportFunctions.GetRptCultureCode(otSession);
- ds.Tables[0].Rows[0]["ReportCurrencyCode"] = Epicor.Mfg.Lib.Report.EpiReportFunctions.GetRptCurrencyCode(ds.Tables[0].Rows[0]["ReportCultureCode"].ToString(), otSession);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement