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

📄 calmquery.pas

📁 彩票销售系统
💻 PAS
📖 第 1 页 / 共 3 页
字号:
      end;
      if OneSixListSp.FieldByName('FTranType').Value=35 then //(1-6)红波
      begin
        if OneSixListSp.FieldByName('1').Value>0 then  begin Label191.Caption:=floattostr(OneSixListSp.FieldByName('1').Value); Label191.Visible:=true; end else begin  label191.caption:='';label191.Visible:=false; end;
        if OneSixListSp.FieldByName('2').Value>0 then  begin Label192.Caption:=floattostr(OneSixListSp.FieldByName('2').Value); Label192.Visible:=true; end else begin  label192.caption:='';label192.Visible:=false; end;
        if OneSixListSp.FieldByName('3').Value>0 then  begin Label193.Caption:=floattostr(OneSixListSp.FieldByName('3').Value); Label193.Visible:=true; end else begin  label193.caption:='';label193.Visible:=false; end;
        if OneSixListSp.FieldByName('4').Value>0 then  begin Label194.Caption:=floattostr(OneSixListSp.FieldByName('4').Value); Label194.Visible:=true; end else begin  label194.caption:='';label194.Visible:=false; end;
        if OneSixListSp.FieldByName('5').Value>0 then  begin Label195.Caption:=floattostr(OneSixListSp.FieldByName('5').Value); Label195.Visible:=true; end else begin  label195.caption:='';label195.Visible:=false; end;
        if OneSixListSp.FieldByName('6').Value>0 then  begin Label196.Caption:=floattostr(OneSixListSp.FieldByName('6').Value); Label196.Visible:=true; end else begin  label196.caption:='';label196.Visible:=false; end;
      end;
      if OneSixListSp.FieldByName('FTranType').Value=36 then  //(1-6)绿波
      begin
        if OneSixListSp.FieldByName('1').Value>0 then   begin Label197.Caption:=floattostr(OneSixListSp.FieldByName('1').Value);  Label197.Visible:=true; end else   begin  label197.caption:=''; label197.Visible:=false; end;
        if OneSixListSp.FieldByName('2').Value>0 then  begin Label198.Caption:=floattostr(OneSixListSp.FieldByName('2').Value); Label198.Visible:=true; end else begin  label198.caption:='';label198.Visible:=false; end;
        if OneSixListSp.FieldByName('3').Value>0 then  begin Label199.Caption:=floattostr(OneSixListSp.FieldByName('3').Value); Label199.Visible:=true; end else begin  label199.caption:='';label199.Visible:=false; end;
        if OneSixListSp.FieldByName('4').Value>0 then  begin Label200.Caption:=floattostr(OneSixListSp.FieldByName('4').Value); Label200.Visible:=true; end else begin  label200.caption:='';label200.Visible:=false; end;
        if OneSixListSp.FieldByName('5').Value>0 then  begin Label201.Caption:=floattostr(OneSixListSp.FieldByName('5').Value); Label201.Visible:=true; end else begin  label201.caption:='';label201.Visible:=false; end;
        if OneSixListSp.FieldByName('6').Value>0 then  begin Label202.Caption:=floattostr(OneSixListSp.FieldByName('6').Value); Label202.Visible:=true; end else begin  label202.caption:='';label202.Visible:=false; end;
      end;
      if OneSixListSp.FieldByName('FTranType').Value=37 then   //(1-6)蓝波
      begin
        if OneSixListSp.FieldByName('1').Value>0 then  begin Label203.Caption:=floattostr(OneSixListSp.FieldByName('1').Value); Label203.Visible:=true; end else begin  label203.caption:='';label203.Visible:=false; end;
        if OneSixListSp.FieldByName('2').Value>0 then  begin Label204.Caption:=floattostr(OneSixListSp.FieldByName('2').Value); Label204.Visible:=true; end else begin  label204.caption:='';label204.Visible:=false; end;
        if OneSixListSp.FieldByName('3').Value>0 then  begin Label205.Caption:=floattostr(OneSixListSp.FieldByName('3').Value); Label205.Visible:=true; end else begin  label205.caption:='';label205.Visible:=false; end;
        if OneSixListSp.FieldByName('4').Value>0 then  begin Label206.Caption:=floattostr(OneSixListSp.FieldByName('4').Value); Label206.Visible:=true; end else begin  label206.caption:='';label206.Visible:=false; end;
        if OneSixListSp.FieldByName('5').Value>0 then  begin Label207.Caption:=floattostr(OneSixListSp.FieldByName('5').Value); Label207.Visible:=true; end else begin  label207.caption:='';label207.Visible:=false; end;
        if OneSixListSp.FieldByName('6').Value>0 then  begin Label208.Caption:=floattostr(OneSixListSp.FieldByName('6').Value); Label208.Visible:=true; end else begin  label208.caption:='';label208.Visible:=false; end;
      end;
      OneSixListSp.Next;
    end;
  end
  else
  begin
    OneSixLabelList(Sender);
  end;
  OneSixListSp.close;
  twothere_sp.Close;
  twothere_sp.Parameters[1].Value:=saleperiod ;
  twothere_sp.Parameters[2].Value:=0;
  twothere_sp.Open;
  SpyBunch_Sp.Close;
  SpyBunch_Sp.Parameters[1].Value:=saleperiod ;
  SpyBunch_Sp.Parameters[2].Value:=0;
  SpyBunch_Sp.Open;

end;

procedure TCalmQueryForm.BitBtn3Click(Sender: TObject);
const 
  LeftBlank=1;//定义页边距单位厘米
  RightBlank=1;
  TopBlank=2;
  BottomBlank=3;

var
  PointX,PointY,lx,ly:integer;
  PointScale,PrintStep:integer;
  s:string;
  x,y,y1:integer;
  i,j:integer;
  print_ti:boolean;
  comno:string;
begin
  print_ti:=false;
  comno:='hl00';
  //获取当前打印机的分辨率
  PointX:=Trunc(GetDeviceCaps(Printer.Handle,LOGPIXELSX)/2.54);
  PointY:=Trunc(GetDeviceCaps(Printer.Handle,LOGPIXELSY)/2.54);
  //根据打印机和屏幕的分辨率计算出从屏幕转换到打印机的比例
  PointScale:=Trunc(GetDeviceCaps(Printer.Handle,LOGPIXELSX)/Screen.PixelsPerInch+0.5);
  j:=0;
  //横向打印
  for i:=0 to DBGrid1.FieldCount-1 do
  begin
    if DBGrid1.Columns[i].Visible then
    begin
      j:=j+1;
    end;
  end;
  if j<10 then
    printer.Orientation:=poPortrait
  else
    printer.Orientation:=poLandscape;
  //打印的字体和大小
  printer.Canvas.Font.Name:='宋体';
  printer.canvas.Font.Size:=14;
  //根据字体的大小确定每行的高度
  s:='有限公司';
  PrintStep:=printer.canvas.TextHeight(s)+26;
  //打印的起点位置
  x:=PointX*LeftBlank;
  y:=PointY*TopBlank;
  ly:=PointY*TopBlank+100;
  //DataSource1是DBGrid1所连接的数据源
  if ((DataSource1.DataSet).Active=true) and ((DataSource1.DataSet).RecordCount>0) then
  begin
     printer.BeginDoc;
    (DataSource1.DataSet).First;
    while not (DataSource1.DataSet).Eof do
    begin //打印DBGrid中的所有列
      for i:=0 to DBGrid1.FieldCount-1 do
      begin
        if DBGrid1.Columns[i].Visible then
        begin
        //假如所要打印的列超出了打印范围,则忽略该列
          if (x+DBGrid1.Columns.Items[i].Width*PointScale)<=(Printer.PageWidth-PointX*RightBlank)then
          begin //画表格线
            //**打印标题**//
            if y=PointY*TopBlank then
            begin
            if not print_ti then
            begin
              printer.Canvas.Font.Name:='宋体';
              printer.canvas.Font.Size:=18;
              comno:='                                     二、三明细表 ' ;
              Printer.Canvas.TextOut(x+60,y-160,comno);
              printer.Canvas.Font.Name:='宋体';
              printer.canvas.Font.Size:=14;
              comno:='                          打印时间:'+DateToStr(Date);
              //comno:='装车车号:'+combobox1.text+'        起点:'+ADOQuery1.Fields[0].value+'         终点:'+ADOQuery1.Fields[1].value+'         合计运费:'+floattostr(ADOQuery1.Fields[2].value)+'      支付运费:'+Label10.Caption+'        装车时间:'+DateToStr(ty_data.Date);
              Printer.Canvas.TextOut(x,y-20,comno);
              print_ti:=true;
              y:=y+100;
            end;
            end;
            Printer.Canvas.Rectangle(x,y-8,x+DBGrid1.Columns.Items[i].Width*PointScale,y+PrintStep);
            if y=ly then
            begin
              printer.Canvas.Font.Name:='宋体';
              printer.canvas.Font.Size:=14;
              Printer.Canvas.TextOut(x+8,y,DBGrid1.Columns[i].Title.Caption);
            end
          else
            begin
              printer.Canvas.Font.Name:='宋体';
              printer.canvas.Font.Size:=14;
              Printer.Canvas.TextOut(x+8,y,DBGrid1.Fields[i].asString);
            end;
          end;
          //计算下一列的横坐标
          x:=x+DBGrid1.Columns.Items[i].Width*PointScale;
        end;
      end;
      //if not (y=PointY*TopBlank) then (DataSource1.DataSet).next;
      if not (y=ly) then (DataSource1.DataSet).next;
      x:=PointX*LeftBlank;
      y:=y+PrintStep; //换页
      if (y+PrintStep)>(Printer.PageHeight-PointY*BottomBlank) then
      begin
        Printer.NewPage;
        y:=PointY*TopBlank;
        print_ti:=false;
      end;
    end;
    printer.Canvas.Font.Name:='宋体';
    printer.canvas.Font.Size:=12;
    //comno:='共'+IntToStr(emppaylistsp.RecordCount)+'条记录';
    Printer.Canvas.TextOut(x+60,y+60,comno);
    printer.EndDoc;
    Application.MessageBox('打印完成','打印',32);
    (DataSource1.DataSet).First;
   end ;

end;

procedure TCalmQueryForm.BitBtn1Click(Sender: TObject);
const 
  LeftBlank=1;//定义页边距单位厘米
  RightBlank=1;
  TopBlank=2;
  BottomBlank=3;

var
  PointX,PointY,lx,ly:integer;
  PointScale,PrintStep:integer;
  s:string;
  x,y,y1:integer;
  i,j:integer;
  print_ti:boolean;
  comno:string;
begin
  print_ti:=false;
  comno:='hl00';
  //获取当前打印机的分辨率
  PointX:=Trunc(GetDeviceCaps(Printer.Handle,LOGPIXELSX)/2.54);
  PointY:=Trunc(GetDeviceCaps(Printer.Handle,LOGPIXELSY)/2.54);
  //根据打印机和屏幕的分辨率计算出从屏幕转换到打印机的比例
  PointScale:=Trunc(GetDeviceCaps(Printer.Handle,LOGPIXELSX)/Screen.PixelsPerInch+0.5);
  j:=0;
  //横向打印
  for i:=0 to DBGrid1.FieldCount-1 do
  begin
    if DBGrid1.Columns[i].Visible then
    begin
      j:=j+1;
    end;
  end;
  if j<10 then
    printer.Orientation:=poPortrait
  else
    printer.Orientation:=poLandscape;
  //打印的字体和大小
  printer.Canvas.Font.Name:='宋体';
  printer.canvas.Font.Size:=10;
  //根据字体的大小确定每行的高度
  s:='有限公司';
  PrintStep:=printer.canvas.TextHeight(s)+26;
  //打印的起点位置
  x:=PointX*LeftBlank;
  y:=PointY*TopBlank;
  ly:=PointY*TopBlank+100;
  //DataSource1是DBGrid1所连接的数据源
  if ((DataSource2.DataSet).Active=true) and ((DataSource2.DataSet).RecordCount>0) then
  begin
     printer.BeginDoc;
    (DataSource2.DataSet).First;
    while not (DataSource2.DataSet).Eof do
    begin //打印DBGrid中的所有列
      for i:=0 to DBGrid2.FieldCount-1 do
      begin
        if DBGrid2.Columns[i].Visible then
        begin
        //假如所要打印的列超出了打印范围,则忽略该列
          if (x+DBGrid2.Columns.Items[i].Width*PointScale)<=(Printer.PageWidth-PointX*RightBlank)then
          begin //画表格线
            //**打印标题**//
            if y=PointY*TopBlank then
            begin
            if not print_ti then
            begin
              printer.Canvas.Font.Name:='宋体';
              printer.canvas.Font.Size:=18;
              comno:='                                     特串明细表 ' ;
              Printer.Canvas.TextOut(x+60,y-160,comno);
              printer.Canvas.Font.Name:='宋体';
              printer.canvas.Font.Size:=14;
              comno:='                          打印时间:'+DateToStr(Date);
              //comno:='装车车号:'+combobox1.text+'        起点:'+ADOQuery1.Fields[0].value+'         终点:'+ADOQuery1.Fields[1].value+'         合计运费:'+floattostr(ADOQuery1.Fields[2].value)+'      支付运费:'+Label10.Caption+'        装车时间:'+DateToStr(ty_data.Date);
              Printer.Canvas.TextOut(x,y-20,comno);
              print_ti:=true;
              y:=y+100;
            end;
            end;
            Printer.Canvas.Rectangle(x,y-8,x+DBGrid2.Columns.Items[i].Width*PointScale,y+PrintStep);
            if y=ly then
            begin
              printer.Canvas.Font.Name:='宋体';
              printer.canvas.Font.Size:=14;
              Printer.Canvas.TextOut(x+8,y,DBGrid2.Columns[i].Title.Caption);
            end
          else
            begin
              printer.Canvas.Font.Name:='宋体';
              printer.canvas.Font.Size:=14;
              Printer.Canvas.TextOut(x+8,y,DBGrid2.Fields[i].asString);
            end;
          end;
          //计算下一列的横坐标
          x:=x+DBGrid2.Columns.Items[i].Width*PointScale;
        end;
      end;
      //if not (y=PointY*TopBlank) then (DataSource1.DataSet).next;
      if not (y=ly) then (DataSource2.DataSet).next;
      x:=PointX*LeftBlank;
      y:=y+PrintStep; //换页
      if (y+PrintStep)>(Printer.PageHeight-PointY*BottomBlank) then
      begin
        Printer.NewPage;
        y:=PointY*TopBlank;
        print_ti:=false;
      end;
    end;
    printer.Canvas.Font.Name:='宋体';
    printer.canvas.Font.Size:=14;
    //comno:='共'+IntToStr(emppaylistsp.RecordCount)+'条记录';
    Printer.Canvas.TextOut(x+60,y+60,comno);
    printer.EndDoc;
    Application.MessageBox('打印完成','打印',32);
    (DataSource2.DataSet).First;
   end ;

⌨️ 快捷键说明

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