private void m_printENCol(System.Drawing.Printing.PrintPageEventArgs e, clsReportSendMed_VO sendMedCH, float width, float StartRow) { StartRow += 15; width = fwidth; e.Graphics.DrawString("药品名称", TextFont, Brushes.Black, width, StartRow); e.Graphics.DrawString("规格", TextFont, Brushes.Black, width + 300, StartRow); e.Graphics.DrawString("剂量", TextFont, Brushes.Black, width + 520, StartRow); e.Graphics.DrawString("用法", TextFont, Brushes.Black, width + 580, StartRow); e.Graphics.DrawString("总数", TextFont, Brushes.Black, width + 700, StartRow); }
private void m_printNew(System.Drawing.Printing.PrintPageEventArgs e, clsReportSendMed_VO sendMedCH, clsReportSendMed_VO sendMedCHNext, clsReportSendMedStart_VO ReportSendMedStart, float width, float StartRow) { e.Graphics.DrawString(sendMedCH.m_strMedName, TextFont, Brushes.Black, width, StartRow); e.Graphics.DrawString(sendMedCH.m_strdosage + sendMedCH.m_strdosageUnit, TextFont, Brushes.Black, width + 150, StartRow); e.Graphics.DrawString(sendMedCH.m_strUseName, TextFont, Brushes.Black, width + 250, StartRow); if (sendMedCHNext != null) { float tempWith = width + 400; e.Graphics.DrawString(sendMedCHNext.m_strMedName, TextFont, Brushes.Black, tempWith, StartRow); e.Graphics.DrawString(sendMedCHNext.m_strdosage + sendMedCHNext.m_strdosageUnit, TextFont, Brushes.Black, tempWith + 150, StartRow); e.Graphics.DrawString(sendMedCHNext.m_strUseName, TextFont, Brushes.Black, tempWith + 250, StartRow); } }
private void m_printEN(System.Drawing.Printing.PrintPageEventArgs e, clsReportSendMed_VO sendMedCH, float width, float StartRow) { if (e.Graphics.MeasureString(sendMedCH.m_strMedName, TextFont).Width > 307) { StartRow += 10; string str1 = sendMedCH.m_strMedName.Substring(0, 15); string str2 = sendMedCH.m_strMedName.Substring(15); e.Graphics.DrawString(str1, TextFont, Brushes.Black, width, StartRow - 13); e.Graphics.DrawString(str2, TextFont, Brushes.Black, width, StartRow + 2); } else { e.Graphics.DrawString(sendMedCH.m_strMedName, TextFont, Brushes.Black, width, StartRow); } e.Graphics.DrawString(sendMedCH.m_strMedSpace, TextFont, Brushes.Black, width + 300, StartRow); if (sendMedCH.m_strdosage.Trim() != "") { e.Graphics.DrawString(sendMedCH.m_strdosage.Trim() + sendMedCH.m_strdosageUnit, TextFont, Brushes.Black, width + 520, StartRow); } e.Graphics.DrawString(sendMedCH.m_strUseName.Trim(), TextFont, Brushes.Black, width + 580, StartRow); e.Graphics.DrawString(sendMedCH.m_strTotal + sendMedCH.m_strMedUnit, TextFont, Brushes.Black, width + 700, StartRow); //HasMorePages=true; }
// int currRow=0; public void m_lngPrint(System.Drawing.Printing.PrintPageEventArgs e, clsReportSendMedStart_VO ReportSendMedStart, clsReportSendMed_VO[] sendMedEN, clsReportSendMed_VO[] sendMedCH) { if (sendMedCH != null && sendMedCH.Length != 0 && currPage == 2) { clsReportSendMed_VO[] sendMedCHAndEN = new clsReportSendMed_VO[sendMedCH.Length]; //保存中成药数据 clsReportSendMed_VO[] sendMedCH1 = new clsReportSendMed_VO[sendMedCH.Length]; //保存中药数据 int intCount = 0; //保存中成药的数量 int intCount1 = 0; //保存中药的数量 for (int i1 = 0; i1 < sendMedCH.Length; i1++) { if (sendMedCH[i1].m_strMedType == "2") { sendMedCHAndEN[intCount] = new clsReportSendMed_VO(); sendMedCHAndEN[intCount].m_strdosage = sendMedCH[i1].m_strdosage; sendMedCHAndEN[intCount].m_strdosageUnit = sendMedCH[i1].m_strdosageUnit; sendMedCHAndEN[intCount].m_strMedName = sendMedCH[i1].m_strMedName; sendMedCHAndEN[intCount].m_strMedSpace = sendMedCH[i1].m_strMedSpace; sendMedCHAndEN[intCount].m_strMedType = sendMedCH[i1].m_strMedType; sendMedCHAndEN[intCount].m_strMedUnit = sendMedCH[i1].m_strMedUnit; sendMedCHAndEN[intCount].m_strTotal = sendMedCH[i1].m_strTotal; sendMedCHAndEN[intCount].m_strUseName = sendMedCH[i1].m_strUseName; intCount++; } else { sendMedCH1[intCount1] = new clsReportSendMed_VO(); sendMedCH1[intCount1].m_strdosage = sendMedCH[i1].m_strdosage; sendMedCH1[intCount1].m_strdosageUnit = sendMedCH[i1].m_strdosageUnit; sendMedCH1[intCount1].m_strMedName = sendMedCH[i1].m_strMedName; sendMedCH1[intCount1].m_strMedSpace = sendMedCH[i1].m_strMedSpace; sendMedCH1[intCount1].m_strMedType = sendMedCH[i1].m_strMedType; sendMedCH1[intCount1].m_strMedUnit = sendMedCH[i1].m_strMedUnit; sendMedCH1[intCount1].m_strTotal = sendMedCH[i1].m_strTotal; sendMedCH1[intCount1].m_strUseName = sendMedCH[i1].m_strUseName; intCount1++; } } for (int i1 = 0; i1 < intCount; i1++) { sendMedCH1[intCount1 + i1] = new clsReportSendMed_VO(); sendMedCH1[intCount1 + i1].m_strdosage = sendMedCHAndEN[i1].m_strdosage; sendMedCH1[intCount1 + i1].m_strdosageUnit = sendMedCHAndEN[i1].m_strdosageUnit; sendMedCH1[intCount1 + i1].m_strMedName = sendMedCHAndEN[i1].m_strMedName; sendMedCH1[intCount1 + i1].m_strMedSpace = sendMedCHAndEN[i1].m_strMedSpace; sendMedCH1[intCount1 + i1].m_strMedType = sendMedCHAndEN[i1].m_strMedType; sendMedCH1[intCount1 + i1].m_strMedUnit = sendMedCHAndEN[i1].m_strMedUnit; sendMedCH1[intCount1 + i1].m_strTotal = sendMedCHAndEN[i1].m_strTotal; sendMedCH1[intCount1 + i1].m_strUseName = sendMedCHAndEN[i1].m_strUseName; } // m_mthPrintTitleCHPage(e,ReportSendMedStart,pageint.ToString()+"/"+totailPageCH.ToString()); // width=fwidth; // for(int f2=currRow;f2<sendMedCH1.Length;f2++) // { // if(sendMedCH1[f2].m_strMedType=="3") // { // if(f2+1<sendMedCH1.Length&&sendMedCH1[f2+1].m_strMedType=="3") // { // if(StartRow+RowHight<=e.PageBounds.Height) // { // m_printNew(e,sendMedCH1[f2],sendMedCH1[f2+1],ReportSendMedStart,width,StartRow); // StartRow+=RowHight; // f2++; // } // else // { // pageint++; // currRow=f2; // e.HasMorePages=true; // return; // } // } // // } // } // m_printEend(e,ReportSendMedStart); if (intCount * 2 + intCount1 < 26) { if (intCount == 0) //只有中药 { m_mthPrintTitleCH(e, ReportSendMedStart); m_printMedCH(e, sendMedCH, ReportSendMedStart, 0, sendMedCH.Length, "3"); currPage = 1; m_printEend(e, ReportSendMedStart); } else if (intCount1 == 0) //只有中成药 { m_mthPrintTitleCH(e, ReportSendMedStart); currPage = 1; m_printMedCH(e, sendMedCHAndEN, ReportSendMedStart, 0, intCount + 1, "2"); m_printEend(e, ReportSendMedStart); } else //有中成药和中药 { m_mthPrintTitleCH(e, ReportSendMedStart); m_printMedCH(e, sendMedCH1, ReportSendMedStart, 0, intCount1, "3"); m_printMedCH(e, sendMedCHAndEN, ReportSendMedStart, 0, intCount, "2"); currPage = 1; m_printEend(e, ReportSendMedStart); } } else { double kk = sendMedCH.Length / 26; totailPageCH = int.Parse(kk.ToString()); if (sendMedCH.Length % 26 != 0) { totailPageCH++; } for (int k1 = pageintCH; k1 <= totailPageCH; k1++) { if (intCount1 != 0 && intCount == 0) { m_mthPrintTitleCHPage(e, ReportSendMedStart, k1.ToString() + "/" + totailPageCH.ToString()); m_printMedCH(e, sendMedCH1, ReportSendMedStart, currRowCH, endRowCH, "3"); m_printEend(e, ReportSendMedStart); currRowCH = 26 * pageint; if (currRowCH + 26 > sendMedCH.Length) { endRowCH = sendMedCH.Length; } else { endRowCH = currRowCH + 26; } pageintCH++; if (pageintCH <= totailPageCH) { e.HasMorePages = true; break; } currPage = 1; } if (intCount1 == 0 && intCount != 0) { m_mthPrintTitleCHPage(e, ReportSendMedStart, k1.ToString() + "/" + totailPageCH.ToString()); m_printMedCH(e, sendMedCHAndEN, ReportSendMedStart, currRowCH, endRow, "2"); m_printEend(e, ReportSendMedStart); currRowCH = 14 * pageint; if (currRowCH + 14 > intCount) { endRow = intCount; } else { endRow = currRowCH + 14; } pageintCH++; if (pageintCH <= totailPageCH) { e.HasMorePages = true; break; } currPage = 1; } if (intCount1 != 0 && intCount != 0) { double kk1 = (intCount1 / 2 + intCount) / 14; totailPageCH = int.Parse(kk1.ToString()); if ((intCount1 / 2 + intCount) % 14 != 0) { totailPageCH++; } if (t1 != 2) { if (intCount1 <= endRowCH) { endRowCH = intCount1; } PageCH = intCount1 / 26; if (intCount1 % 26 != 0) { PageCH++; } m_mthPrintTitleCHPage(e, ReportSendMedStart, k1.ToString() + "/" + totailPageCH.ToString()); m_printMedCH(e, sendMedCH1, ReportSendMedStart, currRowCH, endRowCH, "3"); m_printEend(e, ReportSendMedStart); currRowCH = 26 * pageint; if (currRowCH + 26 > intCount1) { t1++; endRowCH = intCount1 - 1; endRowENCH = 12 - intCount1 / 32; pageint++; } else { endRowCH = currRowCH + 26; } if (intCount1 > 26) { pageintCH++; } if (pageintCH <= PageCH || endRowENCH == 0) { if (intCount1 < 26) { pageintCH++; } e.HasMorePages = true; break; } } if (t1 == 2) { if (pageChang > 0 || endRowENCH == 0) { m_mthPrintTitleCHPage(e, ReportSendMedStart, k1.ToString() + "/" + totailPageCH.ToString()); } m_printMedCH(e, sendMedCHAndEN, ReportSendMedStart, currRowENCH, endRowENCH, "2"); m_printEend(e, ReportSendMedStart); currRowENCH = endRowENCH; if (currRowENCH + 14 > intCount) { endRowENCH = intCount; } else { endRowENCH = currRowENCH + 14; } pageintCH++; if (pageintCH <= totailPageCH || k2 == 0) { // pageChang++; e.HasMorePages = true; break; } } currPage = 1; } } } } if (sendMedEN != null && sendMedEN.Length != 0 && currPage >= 1 || sendMedCH.Length == 0) { if (currPage == 1) { currPage++; e.HasMorePages = true; } else { if (sendMedEN.Length < 14) { m_mthPrintTitleEN(e, ReportSendMedStart); m_printMedEN(e, sendMedEN, 0, sendMedEN.Length); m_printEend(e, ReportSendMedStart); } else { double kk = sendMedEN.Length / 14; totailPage = int.Parse(kk.ToString()); if (sendMedEN.Length % 14 != 0) { totailPage++; } for (int k1 = pageint; k1 <= totailPage; k1++) { m_mthPrintTitleENPage(e, ReportSendMedStart, k1.ToString() + "/" + totailPage.ToString()); m_printMedEN(e, sendMedEN, currRow, endRow); m_printEend(e, ReportSendMedStart); currRow = 14 * pageint; if (currRow + 14 > sendMedEN.Length) { endRow = sendMedEN.Length; } else { endRow = currRow + 14; } pageint++; if (pageint <= totailPage) { e.HasMorePages = true; break; } } } } } }