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

📄 u_jffr.pas

📁 报纸接运程序,对报纸分捆,打印,查询等,适用于各种报社
💻 PAS
字号:
unit U_jfFR;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, Buttons, QuickRpt, ExtCtrls, QRCtrls;

type
  TF_jfFR = class(TForm)
    GroupBox1: TGroupBox;
    CheckB1: TCheckBox;
    CB_bm: TComboBox;
    DTP1: TDateTimePicker;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    LV1: TListView;
    Label1: TLabel;
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure CheckB1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
   // procedure QuickRep1BeforePrint(Sender: TCustomQuickRep;
      //var PrintReport: Boolean);
   // procedure QuickRep1NeedData(Sender: TObject; var MoreData: Boolean);
    procedure BitBtn3Click(Sender: TObject);

  private
    { Private declarations }
    //currentitem:integer;
  public
    { Public declarations }
  {zfs_Total:double;
  zks_Total:double;
  ws_Total:double;
  zhks_Total:double;  }   //2004/08/13 modify
  end;

var
  F_jfFR: TF_jfFR;

implementation
uses dbobj,U_QReport;
{$R *.dfm}

procedure TF_jfFR.BitBtn2Click(Sender: TObject);
begin
        close;
end;

procedure TF_jfFR.BitBtn1Click(Sender: TObject);
var QueryStr:string;
    WhereString:String;
    Item:TListItem;
begin

        QueryStr:='select a.jh,a.jm,a.bm,a.zfs,b.zks,b.ws,b.zhks,a.jfrq from jfzl a,fybq b  where a.jh=b.jh and a.jfrq=b.bqrq  and a.bm=b.bm ';// and a.jfrq='''+Datetostr(DTP1.Date)+''' order by a.bm,a.jh';
        wherestring:='';
        if ( CheckB1.Checked )and(CB_bm.Text <>'' )then
        begin
                wherestring:=wherestring+' and a.bm='''+trim(CB_bm.Text)+'''';
                CheckB1.Checked:=false;
        end;

        if (wherestring='') then
        begin
                ShowMessage ('你没有选定条件!');
        end
        else
        begin
                // QueryStr:=QueryStr+wherestring+' order by a.jh ' ;
                wherestring:=wherestring+' and a.jfrq='''+Datetostr(DTP1.Date)+'''';
                QueryStr:=QueryStr+wherestring+' order by a.jh ' ;
                with DataModule1.ADODataSet1 do
                begin
                CommandText:=QueryStr;
                try
                        Active:=false;
                        open;
                        LV1.Items.Clear;
                        if  RecordCount>0 then
                        begin
                        while not eof do
                        begin
                                Item:=LV1.Items.Add;
                                Item.Caption:=FieldByName('jh').AsString;
                                Item.SubItems.Add(FieldByName('jm').AsString);
                                Item.SubItems.Add(FieldByName('bm').AsString);
                                //Item.SubItems.Add(FieldByName('bs').AsString);
                                Item.SubItems.Add(FieldByName('zfs').AsString);
                                Item.SubItems.Add(FieldByName('zks').AsString);
                                Item.SubItems.Add(FieldByName('ws').AsString);
                                Item.SubItems.Add(FieldByName('zhks').AsString);
                                Item.SubItems.Add(FieldByName('jfrq').AsString);
                                next;
                        end;
                        close;
                        end
                        else
                        begin
                                ShowMessage ('查无记录!');
                                close;
                        end;

                except
                        close;
                end;
                end;
        end;
              DTP1.Date:=now+1;
              //DTP1.Date:=now;
end;

procedure TF_jfFR.CheckB1Click(Sender: TObject);
begin
        CB_bm.Clear;
        if checkB1.Checked then
        begin
         with DataModule1.ADODataSet1 do
         begin
         try
               Active:=false;
               CommandText:='select bm from bsxxb order by bdm';
               open;
                while not eof do
                begin
                        CB_bm.Items.Add(fieldbyname('bm').AsString);
                        next;
                end;
                close;
                Active:=false;
          except
                Close;
                application.MessageBox('初始化版名错','数据库错误',mb_ok);
                exit;
         end;
         end;
         ActiveControl:=CB_bm;
         end
         else
         begin
                CB_bm.Clear;
                CheckB1.Checked:=false;
         end;

end;

procedure TF_jfFR.FormCreate(Sender: TObject);
begin
        CB_bm.Clear;
        //DTP1.Date:=now;
        DTP1.Date:=now+1;
end;

{procedure TF_jfFR.QuickRep1BeforePrint(Sender: TCustomQuickRep;
  var PrintReport: Boolean);
begin
        curr_record:=0;
        reccount:=self.LV1.Items.Count-1;
        {PrintReport:=false;
        currentitem:=0;
        if   (LV1.SelCount>0) then
        begin
                PrintReport:=(LV1.SelCount>0);
                while not (LV1.Items.Item[currentitem].Selected)  do
                        inc(currentitem);
        end;}
//end;

{procedure TF_jfFR.QuickRep1NeedData(Sender: TObject;
  var MoreData: Boolean);
  //var i:integer;
begin
       if curr_record<=reccount then
                MoreData:=true
        else
                MoreData:=false;  }
      {if LV1.Items.Count<0 then
          showmessage('not count')
      else
      begin
     for i:=0 to  LV1.Items.Count-1  do
     begin
     currentitem:=i;}
     {QRLabel15.Caption:=LV1.Items.Item[currentitem].Caption;
     QRLabel16.Caption:=LV1.Items.Item[currentitem].SubItems[0];
     QRLabel3.Caption:=LV1.Items.Item[currentitem].SubItems[1];
     QRLabel17.Caption:=LV1.Items.Item[currentitem].SubItems[2];
     QRLabel18.Caption:=LV1.Items.Item[currentitem].SubItems[3];
     QRLabel19.Caption:=LV1.Items.Item[currentitem].SubItems[4];
     QRLabel20.Caption:=LV1.Items.Item[currentitem].SubItems[5];
     //QRLabel21.Caption:=LV1.Items.Item[currentitem].SubItems[6];
     QRLabel5.Caption:=LV1.Items.Item[currentitem].SubItems[6];
     //inc(currentitem);
     //end;
     //end;}
//end;

procedure TF_jfFR.BitBtn3Click(Sender: TObject);
var QReport:TF_QReport;
begin
         {zfs_Total:=0;
         zks_Total:=0;
         ws_Total:=0;
         zhks_Total:=0;  }    //2004/08/13 modify
         if LV1.items.count=0 then
         begin
                showmessage('没有可打印的资料');
                exit;
         end;
         QReport:=TF_QReport.Create(self);
         QReport.QRLabel3.Caption:=LV1.Items.Item[0].SubItems[1];
         QReport.QRLabel30.Caption:=copy(FormatDateTime('yyyymmdd',DTP1.Date),5,4);
         QReport.QRLabel5.Caption:=FormatDateTime('yyyy-mm-dd',DTP1.Date);
         //QReport.QRLabel5.Caption:=trim(Datetostr(DTP1.Date));//LV1.Items.Item[curr_record].SubItems[6];
         QReport.CleanupInstance ; 
         QReport.Preview;
         //QReport.Print;
          //F_QReport.Preview;
end;


end.

⌨️ 快捷键说明

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