Welcome

Welcome, thanks to look my blog

Saturday, 21 June 2014

menjadikan 2 baris sebuah label di laporan qreport


unit UnitFrmCtkPesertaCPNS1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, QRPrntr, QuickRpt, ExtCtrls, QRCtrls, StdCtrls, Buttons, jpeg,
  sButton, sPanel, sBitBtn, sGroupBox, DBCtrls, sDBLookupComboBox;

type
  TFrmCtkPesertaCPNS1 = class(TForm)
    sPanel1: TsPanel;
    sBtnPreview: TsButton;
    sBtnPrint: TsButton;
    sGroupBox1: TsGroupBox;
    sBtnZoomPlus: TsBitBtn;
    sBtnZoomMinus: TsBitBtn;
    sBtnKeluar: TsButton;
    QuickRep1: TQuickRep;
    PageHeaderBand1: TQRBand;
    QRLabel4: TQRLabel;
    QRSysData3: TQRSysData;
    QRPreview1: TQRPreview;
    SummaryBand1: TQRBand;
    QRLabel25: TQRLabel;
    QRSysData2: TQRSysData;
    sBtnFirst: TsBitBtn;
    sBtnPrev: TsBitBtn;
    sBtnNext: TsBitBtn;
    sBtnLast: TsBitBtn;
    QRBand1: TQRBand;
    QRLabel5: TQRLabel;
    QRLabel15: TQRLabel;
    QRLabel30: TQRLabel;
    QRLabel32: TQRLabel;
    QRLabel33: TQRLabel;
    QRLabel34: TQRLabel;
    QRLabel35: TQRLabel;
    QRLabel37: TQRLabel;
    QRLabel38: TQRLabel;
    QRLabel39: TQRLabel;
    QRLabel40: TQRLabel;
    QRLabel41: TQRLabel;
    QRLabel42: TQRLabel;
    QRLabel43: TQRLabel;
    QRLabel44: TQRLabel;
    QRLabel45: TQRLabel;
    QRLabel46: TQRLabel;
    QRLabel47: TQRLabel;
    QRLabel48: TQRLabel;
    QRLabel49: TQRLabel;
    QRLabel50: TQRLabel;
    QRLabel51: TQRLabel;
    QRLabel52: TQRLabel;
    QRBand2: TQRBand;
    QRSysData4: TQRSysData;
    QRLabel2: TQRLabel;
    QRLabel3: TQRLabel;
    QRDBText18: TQRDBText;
    QRDBText19: TQRDBText;
    QRDBText20: TQRDBText;
    QRDBText21: TQRDBText;
    QRDBText22: TQRDBText;
    QRDBText23: TQRDBText;
    QRDBText24: TQRDBText;
    QRDBText25: TQRDBText;
    QRDBText26: TQRDBText;
    QRDBText27: TQRDBText;
    QRDBText28: TQRDBText;
    QRDBText29: TQRDBText;
    QRDBText30: TQRDBText;
    QRLabel7: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel13: TQRLabel;
    QRDBText31: TQRDBText;
    QRDBText32: TQRDBText;
    QRDBText33: TQRDBText;
    QRDBText34: TQRDBText;
    QRLabel6: TQRLabel;
    QRLabel1: TQRLabel;
    procedure QuickRep1Preview(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure sBtnPreviewClick(Sender: TObject);
    procedure sBtnPrintClick(Sender: TObject);
    procedure sBtnZoomPlusClick(Sender: TObject);
    procedure sBtnZoomMinusClick(Sender: TObject);
    procedure sBtnKeluarClick(Sender: TObject);
    procedure DetailBand1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    procedure sBtnFirstClick(Sender: TObject);
    procedure sBtnPrevClick(Sender: TObject);
    procedure sBtnNextClick(Sender: TObject);
    procedure sBtnLastClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure sDBLCBoxNoUsulanCloseUp(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmCtkPesertaCPNS1: TFrmCtkPesertaCPNS1;
  Ttl : Currency;
  vNoUsulan:String;

implementation

uses DB, Math, UnitDM, StrUtils;

{$R *.dfm}

procedure TFrmCtkPesertaCPNS1.QuickRep1Preview(Sender: TObject);
begin
 QRPreview1.QRPrinter := TQRPrinter(Sender);
end;

procedure TFrmCtkPesertaCPNS1.FormActivate(Sender: TObject);
begin
 QRPreview1.QRPrinter := TQRPrinter.Create;
 QRPreview1.Align:=alClient;
end;

procedure TFrmCtkPesertaCPNS1.sBtnPreviewClick(Sender: TObject);
begin
{  with DM.SQLQrlCtkNIPCPNS do
    begin
      SQL.Clear;
      SQL.Text:='select a.no_usulan,a.nik,a.kd_stspgw,a.kd_golcpns,a.mskerjathn,a.mskerjabln,'+
                'a.gaji_prosentase,a.gaji,a.jabatan,a.kd_loker,a.tmt_cpns,a.nip,b.tgl_usul,b.kanreg_tgl,b.kd_induk,'+
                'a.ijazah,a.kd_pddk from cpns_nip_d a, cpns_nip_h b '+
                'where a.no_usulan=b.no_usulan and a.no_usulan='+QuotedStr(vNoUsulan);
      Active:=True;
    end;
  if DM.SQLQrlCtkNIPCPNS.RecordCount=0 then
     begin
        MessageDlg('Record Null ...!',mtError,[mbOK],0);
        Exit;
     end;}
  QuickRep1.Preview;
end;

procedure TFrmCtkPesertaCPNS1.sBtnPrintClick(Sender: TObject);
begin
 QuickRep1.Print;
end;

procedure TFrmCtkPesertaCPNS1.sBtnZoomPlusClick(Sender: TObject);
begin
  QRPreview1.Zoom:=QRPreview1.Zoom+1;
end;

procedure TFrmCtkPesertaCPNS1.sBtnZoomMinusClick(Sender: TObject);
begin
  QRPreview1.Zoom:=QRPreview1.Zoom-1;
end;

procedure TFrmCtkPesertaCPNS1.sBtnKeluarClick(Sender: TObject);
begin
 QRPreview1.QRPrinter.ClosePreview(Self);
 Close;
end;

procedure TFrmCtkPesertaCPNS1.DetailBand1BeforePrint(
  Sender: TQRCustomBand; var PrintBand: Boolean);
  var i,vI, vPjg:Integer;
begin
  //QRLabel2.Caption:=UpperCase(DM.SQLQryCVnama_cpns.Value);
  QRLabel3.Caption:=UpperCase(Trim(DM.SQLQryCVNmKotaLhr.Value))+', '+DateToStr(DM.SQLQryCVtgl_lhr.Value);
  QRLabel7.Caption:=UpperCase(Trim(DM.SQLQryCValmt_cpns.Value))+', '+DM.SQLQryCVrt_cpns.Value+', '+DM.SQLQryCVrw_cpns.Value;
  QRLabel9.Caption:=UpperCase(Trim(DM.SQLQryCVNmProp.Value))+', '+DM.SQLQryCVNmKabKota.Value;
  QRLabel13.Caption:=UpperCase(Trim(DM.SQLQryCVNmKec.Value))+', '+DM.SQLQryCVKd_Kel.Value;
  vPjg:=length(Trim(DM.SQLQryCVnama_cpns.Value));
    if vPjg>20 then
      begin
       for i:=20 to vPjg do
          begin
            if MidStr(DM.SQLQryCVnama_cpns.Value,i,1)=' ' then
               begin
                QRLabel2.Caption:=UpperCase(MidStr(DM.SQLQryCVnama_cpns.Value,1,i-1));
                QRLabel1.Caption:=UpperCase(MidStr(DM.SQLQryCVnama_cpns.Value,i+1,vPjg-(i+1)));
                Break;
               end;
          end;
      end
   else
      begin
       QRLabel2.Caption:=UpperCase(Trim(DM.SQLQryCVnama_cpns.Value));
       QRLabel1.Caption:='';
      end;
      {  vI:=0;
   vPjg:=length(DM.SQLQryCVnama_cpns.Value);
   for i:=1 to vPjg do
     begin
       if MidStr(DM.SQLQryCVnama_cpns.Value,i,1)='/' then vI:=vI+1;
        if vI=3 then
           begin
             QRLabel6.Caption:=MidStr(DM.SQLQryCVnama_cpns.Value,1,i);
             QRLabel32.Caption:=MidStr(DM.SQLQryCVnama_cpns.Value,i+1,vPjg-i);
             Break;
           end;
     end;
   if vI<>3 then
      begin
        QRLabel6.Caption:=DM.SQLQryCVnama_cpns.Value;
        QRLabel32.Caption:='';
      end; }

end;

procedure TFrmCtkPesertaCPNS1.sBtnFirstClick(Sender: TObject);
begin
  QrPreview1.PageNumber := 1;
end;

procedure TFrmCtkPesertaCPNS1.sBtnPrevClick(Sender: TObject);
begin
  If QrPreview1.PageNumber > 1 then
     QrPreview1.PageNumber := QrPreview1.PageNumber - 1;
end;

procedure TFrmCtkPesertaCPNS1.sBtnNextClick(Sender: TObject);
begin
  If QrPreview1.PageNumber < QrPreview1.QRPrinter.PageCount then
     QrPreview1.PageNumber := QrPreview1.PageNumber + 1;

end;

procedure TFrmCtkPesertaCPNS1.sBtnLastClick(Sender: TObject);
begin
  QrPreview1.PageNumber := QrPreview1.QRPrinter.PageCount;
end;

procedure TFrmCtkPesertaCPNS1.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  if MessageDlg('Yakin Anda Keluar Dari Program Laporan?', mtConfirmation, [mbYes, mbNo], 0 ) = mrYes Then
     Exit
  else
     Abort;
end;

procedure TFrmCtkPesertaCPNS1.sDBLCBoxNoUsulanCloseUp(Sender: TObject);
begin
  {if Not(sDBLCBoxNoUsulan.KeyValue=Null) then
     vNoUsulan:=sDBLCBoxNoUsulan.KeyValue;}
end;

end.

No comments:

Post a Comment