public GetSource GetPrintData(DataTable dt) { GetSource gs = new GetSource(); if (dt.Rows.Count == 1) { var pa = dt.Rows[0]["P_Account"].ToString().PadLeft(6, ' '); var pan = dt.Rows[0]["P_AccountNo"].ToString().PadLeft(7, ' '); var g = dt.Rows[0]["SalesGaku"].ToString().Split('.').FirstOrDefault().PadLeft(7, ' '); var sg = g; //gs.pa_1 = pa[0].ToString(); //gs.pa_2 = pa[1].ToString(); //gs.pa_3 = pa[2].ToString(); //gs.pa_4 = pa[3].ToString(); //gs.pa_5 = pa[4].ToString(); //gs.pa_6 = pa[5].ToString(); //gs.pan_1 = pan[0].ToString(); //gs.pan_2 = pan[1].ToString(); //gs.pan_3 = pan[2].ToString(); //gs.pan_4 = pan[3].ToString(); //gs.pan_5 = pan[4].ToString(); //gs.pan_6 = pan[5].ToString(); //gs.pan_7 = pan[6].ToString(); //gs.sg_1 = sg[0].ToString(); //gs.sg_2 = sg[1].ToString(); //gs.sg_3 = sg[2].ToString(); //gs.sg_4 = sg[3].ToString(); //gs.sg_5 = sg[4].ToString(); //gs.sg_6 = sg[5].ToString(); //gs.sg_7 = sg[6].ToString(); gs.pa_1 = "9"; gs.pa_2 = "9"; gs.pa_3 = "9"; gs.pa_4 = "9"; gs.pa_5 = "9"; gs.pa_6 = "9"; gs.pan_1 = "9"; gs.pan_2 = "9"; gs.pan_3 = "9"; gs.pan_4 = "9"; gs.pan_5 = "9"; gs.pan_6 = "9"; gs.pan_7 = "9"; gs.sg_1 = "9"; gs.sg_2 = "9"; gs.sg_3 = "9"; gs.sg_4 = "9"; gs.sg_5 = "9"; gs.sg_6 = "9"; gs.sg_7 = "9"; } return(gs); }
public void Load_Report() { Custom = dtreport.Rows[0]["LongName"].ToString(); yreport yreport = new yreport(); dtreport.Rows[0]["LongName"] = dtreport.Rows[0]["LongName"] + dtreport.Rows[0]["AliasKBN"].ToString(); dtreport.AcceptChanges(); yreport.SetDataSource(dtreport); GetSource gs = GetPrintData(dtreport); yreport.SetParameterValue("pa_1", gs.pa_1); yreport.SetParameterValue("pa_5", gs.pa_5); yreport.SetParameterValue("pa_2", gs.pa_2); yreport.SetParameterValue("pa_3", gs.pa_3); yreport.SetParameterValue("pa_4", gs.pa_4); yreport.SetParameterValue("pa_6", gs.pa_6); yreport.SetParameterValue("pan_1", gs.pan_1); yreport.SetParameterValue("pan_2", gs.pan_2); yreport.SetParameterValue("pan_3", gs.pan_3); yreport.SetParameterValue("pan_4", gs.pan_4); yreport.SetParameterValue("pan_5", gs.pan_5); yreport.SetParameterValue("pan_6", gs.pan_6); yreport.SetParameterValue("pan_7", gs.pan_7); yreport.SetParameterValue("sg_1", gs.sg_1); yreport.SetParameterValue("sg_2", gs.sg_2); yreport.SetParameterValue("sg_3", gs.sg_3); yreport.SetParameterValue("sg_4", gs.sg_4); yreport.SetParameterValue("sg_5", gs.sg_5); yreport.SetParameterValue("sg_6", gs.sg_6); yreport.SetParameterValue("sg_7", gs.sg_7); yreport.SetParameterValue("Custom", Custom); crystalReportViewer1.ReportSource = null; // crystalReportViewer1.RefreshReport(); crystalReportViewer1.ReportSource = yreport; // crystalReportViewer1.RefreshReport(); }