⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 procbill1.pas

📁 某大型医院护士站
💻 PAS
字号:
unit ProcBill1;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, Quickrpt, QRCtrls, Db, DBTables, Wwquery,
  wwstorep;

type
  TfrmProcBill1 = class(TQuickRep)
    DetailBand1: TQRBand;
    lbBed: TQRLabel;
    lbName: TQRLabel;
    lbUsageName: TQRLabel;
    lbKindid: TQRLabel;
    MidLine: TQRShape;
    QRShape2: TQRShape;
    QRShape4: TQRShape;
    QRShape5: TQRShape;
    BottomLine: TQRShape;
    SummaryBand1: TQRBand;
    PageHeaderBand1: TQRBand;
    PageFooterBand1: TQRBand;
    CurWardName: TQRLabel;
    QRSysData1: TQRSysData;
    lbDosage: TQRLabel;
    lbtmName: TQRLabel;
    qryProcBill: TwwQuery;
    lbOrderKind: TQRLabel;
    QRShape3: TQRShape;
    ColumnHeaderBand1: TQRBand;
    QRLabel12: TQRLabel;
    lbUsageTpName: TQRLabel;
    QRLabel13: TQRLabel;
    QRSysData3: TQRSysData;
    QRShape1: TQRShape;
    QRLabel3: TQRLabel;
    QRLabel4: TQRLabel;
    QRLabel5: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRSysData2: TQRSysData;
    qryProcBillBed: TStringField;
    qryProcBillPNm: TStringField;
    qryProcBillUsageNm: TStringField;
    qryProcBillOrderKind: TSmallintField;
    qryProcBillKindId: TSmallintField;
    qryProcBillItemNm: TStringField;
    qryProcBillDosage: TFloatField;
    qryProcBillDoseUnit: TStringField;
    qryProcBillUseTimesNm: TStringField;
    QRShape9: TQRShape;
    QRShape6: TQRShape;
    QRShape7: TQRShape;
    qryProcBillEPlace: TSmallintField;
    lbNew: TQRLabel;
    qryProcBillExeTime: TDateTimeField;
    lbpati: TQRLabel;
    lbexetime: TQRLabel;
    qryProcBillTIMENAME: TStringField;
    QRLabel11: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel6: TQRLabel;
    QRLabel1: TQRLabel;
    QRLabel8: TQRLabel;
    lbItemname: TQRLabel;
    procedure ProcBillNeedData(Sender: TObject; var MoreData: Boolean);
    procedure QRSysData2Print(sender: TObject; var Value: String);
    procedure QuickRepBeforePrint(Sender: TCustomQuickRep;
      var PrintReport: Boolean);
  private

  public
    Bed : String;
    Name : String;
    UsageName : String;
    OrderKind : Integer;
    Kindid : Integer;
    RowCount : Integer;

    BedRange  : SmallInt;
    OrderType : SmallInt;
    SelectPatient : Integer;
    PrintOral  : Boolean;
    printInj   : Boolean;
    PrintMeal  : Boolean;
    PrintTest  : Boolean;
    PrintCheck : Boolean;
    PrintCare  : Boolean;
    PrintCure  : Boolean;
  end;

var
  frmProcBill1 : TfrmProcBill1;

implementation

uses Datamodule, QryPrn, PRNDataModule;

{$R *.DFM}
const
  RowPerPage = 41;
  PageRight = 926-150;

procedure TfrmProcBill1.ProcBillNeedData(Sender: TObject;
  var MoreData: Boolean);
begin
  if qryProcBill.EOF then //数据打印完毕,MoreData设为False停止打印
  begin
    Bed :='';              // Reset these parameters before print
    Name :='';
    UsageName :='';
    OrderKind := -1;
    Kindid := -1;

    MoreData := False;
    RowCount := 3;      // Zheng added
  end
  else
  begin
    MoreData := True;    //数据未打印完,MoreData设为True
    //每页打印一定的行数后,打印页尾底线,并另起一页

    if RowCount + 1 = RowPerPage then
      BottomLine.Enabled := True
    else
      BottomLine.Enabled := False;

    if RowCount = RowPerPage then    // Zheng Modified
    begin // when printed lines equal to RowPerPage
      NewPage;
      RowCount := 0;    // Zheng Added
      MidLine.Left  := 1;
      MidLine.Width := PageRight - MidLine.Left;
      MidLine.Pen.Width := 2;
      lbBed.Caption       := qryProcBillBed.Value;
      lbName.Caption      := qryProcBillPNm.Value;
      if frmqryprn.rgpatitype.ItemIndex = 0 then
      lbpati.Enabled := false
      else
      lbpati.Enabled := true;
      lbUsageName.Caption := qryProcBillUsageNm.Value;

      if qryProcBillOrderKind.Value = 1 then //临时医嘱
        lbOrderKind.Caption := '(T)'
      else
        lbOrderKind.Caption := '   ';

      if qryProcBillExeTime.isnull then  //New order --zheng 8.14,98
        lbNew.Caption := '+'
      else
        lbNew.Caption := ' ';

      lbKindid.Caption    := qryProcBillKindid.AsString;

      if qryProcBillEPlace.Value = 0 then  //本病区药品
        lbItemName.Caption  := '*' + qryProcBillItemNm.AsString
      else if qryProcBillEPlace.Value = 99 then  //自备药品
        lbItemName.Caption  := '#' + qryProcBillItemNm.AsString
      else
        lbItemName.Caption  := qryProcBillItemNm.AsString;

      lbDosage.Caption    := qryProcBillDosage.AsString +
                             qryProcBillDoseUnit.AsString;
      lbtmName.Caption    := qryProcBillUseTimesNm.AsString;
      lbexetime.Caption := qryprocbilltimename.AsString;
    end
    else
    if ( Bed = qryProcBillBed.Value ) then  //the same bedno
    begin
      lbBed.Caption :='';
      if Name = qryProcBillPNm.Value then   //??? the same name (should be implied in bed)
      begin
        lbName.Caption := '';
        lbpati.Enabled := false;
        if UsageName = qryProcBillUsageNm.Value then // the same usage
        begin
          lbUsageName.Caption := '';
          if ( Kindid = qryProcBillKindid.AsInteger ) and  // the same kindid
             ( OrderKind = qryProcBillOrderKind.AsInteger ) then
          begin
            lbOrderKind.Caption := '   ';
            lbKindid.Caption := '';

            if qryProcBillExeTime.isnull then  //New order --zheng 8.14,98
              lbNew.Caption := '+'
            else
              lbNew.Caption := ' ';

            MidLine.Left  := PageRight;
            MidLine.Width := PageRight - MidLine.Left;  // length = 0
            MidLine.Pen.Width := 1;
            if qryProcBillEPlace.Value = 0 then  //本病区药品
              lbItemName.Caption  := '*'+qryProcBillItemNm.AsString
            else if qryProcBillEPlace.Value = 99 then  //自备药品
              lbItemName.Caption  := '#'+qryProcBillItemNm.AsString
            else
              lbItemName.Caption  := qryProcBillItemNm.AsString;
            lbDosage.Caption   := qryProcBillDosage.AsString +
                                  qryProcBillDoseUnit.AsString;
            lbtmName.Caption   := '';
            lbexetime.Caption := qryprocbilltimename.AsString;
          end
          else   //different kindid
          begin
            MidLine.Left  := QRShape4.Left-1;
            if trim(qryProcBillUsageNm.Value) = 'P.O' then
               MidLine.Width := 0
            else
               MidLine.Width := PageRight - MidLine.Left;
            MidLine.Pen.Width := 1;
            if qryProcBillOrderKind.AsInteger = 1 then
              lbOrderKind.Caption := '(T)'
            else
              lbOrderKind.Caption := '   ';
            lbKindid.Caption   := qryProcBillKindid.AsString;

            if qryProcBillExeTime.isnull then  //New order --zheng 8.14,98
              lbNew.Caption := '+'
            else
              lbNew.Caption := ' ';

            if qryProcBillEPlace.Value = 0 then  //本病区药品
              lbItemName.Caption  := '*' + qryProcBillItemNm.AsString
            else if qryProcBillEPlace.Value = 99 then  //自备药品
              lbItemName.Caption  := '#' + qryProcBillItemNm.AsString
            else
              lbItemName.Caption  := qryProcBillItemNm.AsString;
            lbDosage.Caption   := qryProcBillDosage.AsString +
                                  qryProcBillDoseUnit.AsString;
            lbtmName.Caption   := qryProcBillUseTimesNm.AsString;
            lbexetime.Caption := qryprocbilltimename.AsString;
          end;
        end
        else   // different usage
        begin
          MidLine.Left  := 135;
          MidLine.Width := PageRight - MidLine.Left;
          MidLine.Pen.Width := 1;
          lbUsageName.Caption := qryProcBillUsageNm.Value;
          if qryProcBillOrderKind.AsInteger = 1 then
            lbOrderKind.Caption := '(T)'
          else
            lbOrderKind.Caption := '   ';
          lbKindid.Caption    := qryProcBillKindid.AsString;

          if qryProcBillExeTime.isnull then
            lbNew.Caption := '+'
          else
            lbNew.Caption := ' ';

          if qryProcBillEPlace.Value = 0 then  //本病区药品
            lbItemName.Caption  := '*'+qryProcBillItemNm.AsString
          else if qryProcBillEPlace.Value = 99 then  //自备药品
            lbItemName.Caption  := '#'+qryProcBillItemNm.AsString
          else
            lbItemName.Caption  := qryProcBillItemNm.AsString;
          lbDosage.Caption    := qryProcBillDosage.AsString +
                                 qryProcBillDoseUnit.AsString;
          lbtmName.Caption    := qryProcBillUseTimesNm.AsString;
          lbexetime.Caption := qryprocbilltimename.AsString;
        end;
      end
      else     //different name
      begin
        MidLine.Left  := 40;
        MidLine.Width := PageRight - MidLine.Left;
        MidLine.Pen.Width := 1;
        lbName.Caption      := qryProcBillPNm.Value;
        IF frmqryprn.rgpatitype.ItemIndex = 0 then
        lbpati.Enabled := false
      else
      lbpati.Enabled := true;
        lbUsageName.Caption := qryProcBillUsageNm.Value;
        if qryProcBillOrderKind.AsInteger = 1 then
          lbOrderKind.Caption := '(T)'
        else
          lbOrderKind.Caption := '   ';
        lbKindid.Caption    := qryProcBillKindid.AsString;

        if qryProcBillExeTime.isnull then
          lbNew.Caption := '+'
        else
          lbNew.Caption := ' ';

        if qryProcBillEPlace.Value = 0 then  //本病区药品
          lbItemName.Caption  := '*'+qryProcBillItemNm.AsString
        else if qryProcBillEPlace.Value = 99 then  //自备药品
          lbItemName.Caption  := '#'+qryProcBillItemNm.AsString
        else
          lbItemName.Caption  := qryProcBillItemNm.AsString;
        lbDosage.Caption    := qryProcBillDosage.AsString +
                               qryProcBillDoseUnit.AsString;
        lbtmName.Caption    := qryProcBillUseTimesNm.AsString;
        lbexetime.Caption := qryprocbilltimename.AsString;
      end;
    end
    else  // different bed
    begin
      MidLine.Left  := 1;
      MidLine.Width := PageRight - MidLine.Left ;
      MidLine.Pen.Width := 2;
      lbBed.Caption       := qryProcBillBed.Value;
      lbName.Caption      := qryProcBillPNm.Value;
      IF frmqryprn.rgpatitype.ItemIndex = 0 then
      lbpati.Enabled := false
      else
      lbpati.Enabled := true;
      lbUsageName.Caption := qryProcBillUsageNm.Value;
      if qryProcBillOrderKind.AsInteger = 1 then
        lbOrderKind.Caption := '(T)'
      else
        lbOrderKind.Caption := '   ';
      lbKindid.Caption    := qryProcBillKindid.AsString;

      if qryProcBillExeTime.isnull then
        lbNew.Caption := '+'
      else
        lbNew.Caption := ' ';

      if qryProcBillEPlace.Value = 0 then  //本病区药品
        lbItemName.Caption  := '*'+qryProcBillItemNm.AsString
      else if qryProcBillEPlace.Value = 99 then  //自备药品
        lbItemName.Caption  := '#'+qryProcBillItemNm.AsString
      else
        lbItemName.Caption  := qryProcBillItemNm.AsString;

      lbDosage.Caption    := qryProcBillDosage.AsString +
                             qryProcBillDoseUnit.AsString;
      lbtmName.Caption    := qryProcBillUseTimesNm.AsString;
      lbexetime.Caption := qryprocbilltimename.AsString;

    end;

    Bed       := qryProcBillBed.Value;
    name      := qryprocbillpnm.AsString;
    UsageName := qryProcBillUsageNm.Value;
    OrderKind := qryProcBillOrderKind.AsInteger;
    Kindid    := qryProcBillKindid.Value;

    Inc(RowCount);
    qryProcBill.Next;
  end;
end;

procedure TfrmProcBill1.QRSysData2Print(sender: TObject;
  var Value: String);
begin
  if (Not qryProcBill.Active) or qryProcBill.EOF then
    Value := '第 '+ Value +' 页 完'
  else
    Value := '第 '+ Value +' 页'
end;

procedure TfrmProcBill1.QuickRepBeforePrint(Sender: TCustomQuickRep;
  var PrintReport: Boolean);
begin
  if not qryProcBill.Active then
    qryProcBill.Open;
  if qryProcBill.Active then qryProcBill.First;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -