示例#1
0
 //打印瓶贴
 private void btnPrintLabel_Click(object sender, EventArgs e)
 {
     if (this.LabelDetail == null || this.LabelDetail.Rows == null || this.LabelDetail.Rows.Count == 0)
     {
         Message.Show("没有要打印的瓶贴!");
     }
     else
     {
         Form form = new Form();
         form.Size            = new System.Drawing.Size(300, 200);
         form.AutoSize        = true;
         form.FormBorderStyle = FormBorderStyle.FixedDialog;
         form.MaximizeBox     = false;
         CJia.PIVAS.App.UI.Label.PrintLabelView printLabel = new PrintLabelView(this.LabelDetail);
         form.Controls.Add(printLabel);
         printLabel.Dock    = DockStyle.Fill;
         form.StartPosition = FormStartPosition.CenterParent;
         form.ShowDialog();
         if (printLabel.IsPrint)
         {
             int startPage = printLabel.StartNum;
             int stopPage  = printLabel.EndNum;
             this.OnQueryLabelDetailsInfo(null, null);
             CJia.PIVAS.App.UI.Label.PrintLabelReport labelReport = new CJia.PIVAS.App.UI.Label.PrintLabelReport();
             labelReport.allLabel = stopPage - startPage + 1;
             DateTime now = CJia.PIVAS.Tools.Helper.Sysdate;
             for (int i = startPage; i <= stopPage; i++)
             {
                 string labelId = this.LabelDetail.Rows[i - 1]["LABEL_ID"].ToString();
                 CJia.PIVAS.Views.Label.QueryLabelViewEventArgs queryLabelViewEventArgs = new Views.Label.QueryLabelViewEventArgs()
                 {
                     LabelId = labelId
                 };
                 this.OnUpdateBarCode(null, queryLabelViewEventArgs);
                 DataRow[] labelInfos = this.LabelDetailInfo.Select("LABEL_ID = " + labelId);
                 if (labelInfos != null && labelInfos.Length != 0)
                 {
                     string GroupIndex = this.LabelDetail.Rows[i - 1]["GROUP_INDEX"].ToString();
                     this.SendPharm(GroupIndex);
                 }
                 int allLabelCount = (labelInfos.Length - 1) / 4 + 1;
                 for (int j = 1; j <= allLabelCount; j++)
                 {
                     DataTable reportDataSource = this.GetDataSource(labelInfos, j);
                     DataTable barCode          = (DataTable)this.OnGetLabelBarcode(labelId, j, allLabelCount);
                     labelReport.DataBind(reportDataSource, allLabelCount, j, barCode.Rows[0]["LABEL_BAR_ID"].ToString(), (DateTime)barCode.Rows[0]["CREATE_DATE"]);
                     labelReport.LabelPrint();
                     this.OnUpdateLabelPrintStatus(labelId);
                 }
             }
             if (labelReport.PringedLabel > 0)
             {
                 Message.Show("成功打印" + (labelReport.allLabel - labelReport.PringedLabel) + "张瓶贴!忽略" + labelReport.PringedLabel + "张瓶贴!" + "因为这些瓶贴对应的医嘱未通过审核!");
             }
         }
     }
 }
示例#2
0
 //打印瓶贴
 private void btnPrintLabel_Click(object sender, EventArgs e)
 {
     if (this.LabelDetail == null || this.LabelDetail.Rows == null || this.LabelDetail.Rows.Count == 0)
     {
         MessageBox.Show("没有要打印的瓶贴!");
     }
     else
     {
         Form form = new Form();
         form.Size            = new System.Drawing.Size(300, 200);
         form.AutoSize        = true;
         form.FormBorderStyle = FormBorderStyle.FixedDialog;
         form.MaximizeBox     = false;
         CJia.PIVAS.App.UI.Label.PrintLabelView printLabel = new PrintLabelView(this.LabelDetail);
         form.Controls.Add(printLabel);
         printLabel.Dock    = DockStyle.Fill;
         form.StartPosition = FormStartPosition.CenterParent;
         form.ShowDialog();
         if (printLabel.IsPrint)
         {
             int startPage = printLabel.StartNum;
             int stopPage  = printLabel.EndNum;
             this.OnQueryLabelDetailsInfo(null, null);
             CJia.PIVAS.App.UI.Label.PrintLabelReport labelReport = new CJia.PIVAS.App.UI.Label.PrintLabelReport();
             for (int i = startPage; i <= stopPage; i++)
             {
                 string    labelId       = this.LabelDetail.Rows[i - 1]["LABEL_ID"].ToString();
                 DataRow[] labelInfos    = this.LabelDetailInfo.Select("LABEL_ID = " + labelId);
                 int       allLabelCount = (labelInfos.Length - 1) / 4 + 1;
                 for (int j = 1; j <= allLabelCount; j++)
                 {
                     DataTable reportDataSource = this.GetDataSource(labelInfos, j);
                     DataTable barCode          = (DataTable)this.OnGetLabelBarcode(labelId, j, allLabelCount);
                     labelReport.DataBind(reportDataSource, allLabelCount, j, barCode.Rows[0]["LABEL_BAR_ID"].ToString(), (DateTime)barCode.Rows[0]["GEN_DATE"]);
                     labelReport.LabelPrint();
                     this.OnUpdateLabelPrintStatus(labelId);
                 }
             }
         }
     }
 }