?? sy_jyppzzcx.pas
字號(hào):
{*******************************************************}
{ }
{ 集郵票品總帳查詢 }
{ }
{ 中軟金馬公司版權(quán)所有。2002.12前 }
{ }
{ 編制:中軟金馬項(xiàng)目開發(fā)組 }
{ }
{ }
{*******************************************************}
(*
本模塊在省級(jí)集郵票管理、省級(jí)市場購入票管理、省級(jí)集郵品管理、省級(jí)零枚票管理、省級(jí)綜合查詢、
地市集郵票管理、地市集郵品管理、地市市場購入票管理 八個(gè)模塊調(diào)用
*)
unit SY_JYPPZZCX;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
SY_SearchBase, Db, DBTables, Grids, DBGrids, StdCtrls, Buttons, ExtCtrls,
Spin, ComCtrls, RXCtrls, RxQuery, SqlStrings, Qrctrls, QuickRpt, Menus,
DBGridExport;
const
ArrZI: array[1..3] of string = ('', '入', '出');
ArrFieldName: array[0..2] of array[0..2] of string =
(('XJZJJE', 'XJJSJE', 'XJYE'), ('JJZJJE', 'JJJSJE', 'JJYE'), ('YJZJJE', 'YJJSJE', 'YJYE'));
type
TfrmY_JYPPZZCX = class(TfrmY_SearchBase)
RGr_Base: TRadioGroup;
Label2: TLabel;
UD_zi: TUpDown;
Edt_zi: TEdit;
Label1: TLabel;
SED_Year: TSpinEdit;
QRe_jypzz: TQuickRep;
PageHeaderBand1: TQRBand;
QRLabel1: TQRLabel;
QRLabel7: TQRLabel;
QRLabel12: TQRLabel;
QRShape1: TQRShape;
QRSysData1: TQRSysData;
DetailBand1: TQRBand;
QRRichText1: TQRRichText;
QRShape7: TQRShape;
QRRichText2: TQRRichText;
QRRichText3: TQRRichText;
QRShape11: TQRShape;
QRShape12: TQRShape;
QRRichText4: TQRRichText;
QRShape13: TQRShape;
QRShape14: TQRShape;
QRRichText5: TQRRichText;
QRShape15: TQRShape;
QRRichText6: TQRRichText;
QRShape16: TQRShape;
QRShape18: TQRShape;
QRShape21: TQRShape;
QRLabel15: TQRLabel;
ColumnHeaderBand1: TQRBand;
QRL_zz_nd: TQRLabel;
QRLabel2: TQRLabel;
QRLabel6: TQRLabel;
QRLabel8: TQRLabel;
QRLabel9: TQRLabel;
QRLabel10: TQRLabel;
QRLabel11: TQRLabel;
QRLabel3: TQRLabel;
QRLabel4: TQRLabel;
QRLabel5: TQRLabel;
QRShape2: TQRShape;
QRShape3: TQRShape;
QRShape4: TQRShape;
QRShape5: TQRShape;
QRShape6: TQRShape;
QRShape8: TQRShape;
QRShape9: TQRShape;
QRShape10: TQRShape;
QRShape20: TQRShape;
QRShape19: TQRShape;
QRShape22: TQRShape;
QRShape23: TQRShape;
QRShape24: TQRShape;
QRShape25: TQRShape;
QRShape26: TQRShape;
QRShape27: TQRShape;
QRShape28: TQRShape;
QRShape29: TQRShape;
QRLabel13: TQRLabel;
QRShape39: TQRShape;
PageFooterBand1: TQRBand;
QRShape17: TQRShape;
QRLabel14: TQRLabel;
QRShape30: TQRShape;
QRShape31: TQRShape;
QRShape32: TQRShape;
QRShape33: TQRShape;
QRShape34: TQRShape;
QRShape35: TQRShape;
QRShape36: TQRShape;
QRShape37: TQRShape;
QRShape38: TQRShape;
Qry_Print: TRxQuery;
procedure UD_ziChangingEx(Sender: TObject; var AllowChange: Boolean;
NewValue: Smallint; Direction: TUpDownDirection);
procedure SED_YearChange(Sender: TObject);
procedure RGr_BaseClick(Sender: TObject);
procedure Qry_SearchAfterOpen(DataSet: TDataSet);
procedure BBt_PrintClick(Sender: TObject);
procedure QRe_jypzzNeedData(Sender: TObject; var MoreData: Boolean);
procedure QRe_jypzzStartPage(Sender: TCustomQuickRep);
procedure QRe_jypzzBeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
private
{ Private declarations }
FRQFrom, FRQEnd: TDateTime;
protected
property RQFrom: TDateTime read FRQFrom write FRQFrom;
property RQEnd: TDateTime read FRQEnd write FRQEnd;
procedure Init; override;
procedure Search; override;
public
DetailLines: Integer;
Tao_Print_Flag: Boolean;
TotalPageCount: Integer;
Cou_Ye_Flag: Boolean;
BookMrk: TBookMark;
RI: integer;
ZY_Temp: string;
end;
function ShowZZCX(p_typ: TIO_TYPE): Boolean;
var
frmY_JYPPZZCX: TfrmY_JYPPZZCX;
implementation
uses pub,SJ_DialogAfterPrint;
{$R *.DFM}
var
l_typ: TIO_TYPE;
function ShowZZCX(p_typ: TIO_TYPE): Boolean;
begin
l_typ := p_typ;
Application.CreateForm(TfrmY_JYPPZZCX, frmY_JYPPZZCX);
with frmY_JYPPZZCX do
try
l_typ := p_typ;
{$IFDEF qmd}
Caption := CYZPPTIT;
DWMC.Caption := '使用單位:' + VG_UnitName;
panel1.Caption := pCaption[integer(l_typ)] + '總帳校對(duì)';
{$ELSE}
Caption := '郵資票品管理信息系統(tǒng)——' + pCaption[integer(l_typ)] + '業(yè)務(wù)';
panel1.Caption := pCaption[integer(l_typ)] + '總帳查詢';
{$ENDIF}
QRLabel1.Caption := pCaption[integer(l_typ)] + ' 總 帳';
QRLabel1.Left := Round((PageHeaderBand1.width - QRLabel1.width) div 2);
Qry_Search.SQL := SqlStrings.FSqlText[l_typ];
QRe_jypzz.Visible := False;
result := ShowModal = MB_OK;
finally
Free;
end;
end;
procedure TfrmY_JYPPZZCX.Init;
begin
inherited Init;
SED_Year.Value := CurYear;
// RGr_Base.Visible := l_typ <> io_txp;
if RGr_Base.Visible then
RGr_Base.ItemIndex := 1
else
RGr_Base.ItemIndex := 0;
RGr_BaseClick(nil);
end;
procedure TfrmY_JYPPZZCX.UD_ziChangingEx(Sender: TObject;
var AllowChange: Boolean; NewValue: Smallint;
Direction: TUpDownDirection);
begin
inherited;
if (NewValue < 1) or (NewValue > 3) then
begin
Edt_ZI.Text := '';
AllowChange := False;
end
else
begin
Edt_ZI.Text := ArrZI[NewValue];
AllowChange := True;
end;
if NewValue > UD_ZI.Max then
UD_ZI.Position := UD_ZI.Min
else if NewValue < UD_ZI.Min then
UD_ZI.Position := UD_ZI.Max;
end;
procedure TfrmY_JYPPZZCX.SED_YearChange(Sender: TObject);
begin
inherited;
CurYear := SED_Year.Value;
end;
procedure TfrmY_JYPPZZCX.Search;
begin
with Qry_Search do
begin
Close;
Params.ParamByName('RQFrom').Asstring := Sed_year.Text + cmb_From.Text;
Params.ParamByName('RQEnd').Asstring := Sed_year.Text + cmb_End.Text;
Open;
end;
end;
procedure TfrmY_JYPPZZCX.RGr_BaseClick(Sender: TObject);
begin
inherited;
case RGr_Base.ItemIndex of
0, 1:
begin
DBG_Result.Columns[4].FieldName := ArrFieldName[RGr_Base.ItemIndex, 0];
DBG_Result.Columns[5].FieldName := ArrFieldName[RGr_Base.ItemIndex, 1];
DBG_Result.Columns[6].FieldName := ArrFieldName[RGr_Base.ItemIndex, 2];
end;
end;
end;
procedure TfrmY_JYPPZZCX.Qry_SearchAfterOpen(DataSet: TDataSet);
begin
inherited;
with DataSet do
begin
{ if l_typ <> io_txp then
begin
TNumericField(FieldByName('YJZJJE')).DisplayFormat := '#,##0.00##';
TNumericField(FieldByName('YJJSJE')).DisplayFormat := '#,##0.00##';
TNumericField(FieldByName('YJYE')).DisplayFormat := '#,##0.00##';}
TNumericField(FieldByName('JJZJJE')).DisplayFormat := '#,##0.00##';
TNumericField(FieldByName('JJJSJE')).DisplayFormat := '#,##0.00##';
TNumericField(FieldByName('JJYE')).DisplayFormat := '#,##0.00##';
{ end;}
TNumericField(FieldByName('XJZJJE')).DisplayFormat := '#,##0.00##';
TNumericField(FieldByName('XJJSJE')).DisplayFormat := '#,##0.00##';
TNumericField(FieldByName('XJYE')).DisplayFormat := '#,##0.00##';
end;
end;
procedure TfrmY_JYPPZZCX.BBt_PrintClick(Sender: TObject);
begin
//查詢出該年所有月份的信息
Qry_Print.SQL := Qry_Search.SQL;
with Qry_Print do
begin
Close;
Params.ParamByName('RQFrom').Asstring := Sed_year.Text + '01';
Params.ParamByName('RQEnd').Asstring := Sed_year.Text + '12';
Open;
end;
try
if not Qry_Print.Active then exit;
QRL_zz_nd.Caption := SED_Year.Text;
if not AsSigned(Frm_DialogAfterPrint) then
Frm_DialogAfterPrint := TFrm_DialogAfterPrint.Create(Application);
try
DetailLines := 0;
Qry_Print.First;
QRe_jypzz.Prepare;
try
TotalPageCount := QRe_jypzz.QRPrinter.PageCount;
finally
QRe_jypzz.QRPrinter.Free;
end;
QRe_jypzz.QRPrinter := nil;
with Frm_DialogAfterPrint do
begin
SpinEdit1.Value := 1;
SpinEdit2.Value := TotalPageCount;
Refresh;
ShowModal;
if SpinEdit2.Value > TotalPageCount then
SpinEdit2.Value := TotalPageCount;
if SpinEdit2.Value < 1 then
SpinEdit2.Value := 1;
if Close_Flag then
begin
Tao_Print_Flag := CheckBox1.Checked = True;
if RadioButton2.Checked then
begin
QRe_jypzz.PrinterSettings.FirstPage := SpinEdit1.Value;
QRe_jypzz.PrinterSettings.LastPage := SpinEdit2.Value;
end;
end;
end;
DetailLines := 0;
Qry_Print.First;
QRe_jypzz.Preview;
finally
Frm_DialogAfterPrint.Free;
Frm_DialogAfterPrint := nil;
end;
finally
end;
end;
procedure TfrmY_JYPPZZCX.QRe_jypzzNeedData(Sender: TObject;
var MoreData: Boolean);
var
EoF_Flag: boolean;
begin
DetailBand1.Height := 25;
Eof_Flag := Qry_Print.Eof;
if DetailLines <= 18 then
begin
Inc(DetailLines);
MoreData := True;
end;
//為月份信息湊頁
if (not Qry_Print.Eof) and (not Qry_Print.Bof) then
begin
Qry_Print.Prior;
if (Qry_Print.FieldByName('zy').AsString <> ZY_temp) and
(Pos('本年累計(jì)', Qry_Print.FieldByName('zy').AsString) > 0) and ((DetailLines mod 19) <> 0) then
begin
ZY_temp := Qry_Print.FieldByName('zy').AsString;
RI := 19 - Detaillines;
end;
Qry_Print.Next;
end;
if (Ri = 0) and (not Eof_Flag) then
begin
if (DetailLines = 19) and (QRRichText6.Lines.Text = '') then
begin
QRRichText1.Lines.Text := '';
QRRichText2.Lines.Text := '';
QRRichText3.Lines.Text := '';
QRRichText4.Lines.Text := '';
QRRichText5.Lines.Text := '';
QRRichText6.Lines.Text := '';
QRLabel15.Caption := '';
end
else
with Qry_Print do
begin
QRRichText1.Lines.Text := FieldByName('fsrq').AsString;
QRrichText2.Lines.Text := FieldByName('zi').AsString;
QRRichText3.Lines.Text := FieldByName('crkdh').AsString;
QRRichText4.Lines.Text := FieldByName('zy').AsString;
if RGr_Base.ItemIndex = 0 then
begin
QRRichText5.Lines.Text := FormatFloat('#,##0.00', FieldbyName('xjzjje').AsFloat);
QRRichText6.Lines.Text := FormatFloat('#,##0.00', FieldByName('xjjsje').AsFloat);
QRLabel15.Caption := FormatFloat('#,##0.00', FieldByName('xjye').AsFloat);
end
else
begin
{ if l_typ = io_txp then
begin
QRRichText5.Lines.Text := FormatFloat('#,##0.00', FieldbyName('xjzjje').AsFloat);
QRRichText6.Lines.Text := FormatFloat('#,##0.00', FieldByName('xjjsje').AsFloat);
QRLabel15.Caption := FormatFloat('#,##0.00', FieldByName('xjye').AsFloat);
end
else
begin }
QRRichText5.Lines.Text := FormatFloat('#,##0.00', FieldbyName('jjzjje').AsFloat);
QRRichText6.Lines.Text := FormatFloat('#,##0.00', FieldByName('jjjsje').AsFloat);
QRLabel15.Caption := FormatFloat('#,##0.00', FieldByName('jjye').AsFloat);
{end;}
end;
MoreData := not Qry_Print.Eof;
Qry_Print.Next;
end;
end;
if Ri > 0 then
begin
QRRichText1.Lines.Text := '';
QRRichText2.Lines.Text := '';
QRRichText3.Lines.Text := '';
QRRichText4.Lines.Text := '';
QRRichText5.Lines.Text := '';
QRRichText6.Lines.Text := '';
QRLabel15.Caption := '';
Dec(RI);
end;
if MoreData and Eof_Flag then
begin
QRRichText1.Lines.Text := '';
QRRichText2.Lines.Text := '';
QRRichText3.Lines.Text := '';
QRRichText4.Lines.Text := '';
QRRichText5.Lines.Text := '';
QRRichText6.Lines.Text := '';
QRLabel15.Caption := '';
if DetailLines = 19 then
MoreData := False
else
MoreData := True;
end;
if DetailLines = 19 then
DetailLines := 0;
end;
procedure TfrmY_JYPPZZCX.QRe_jypzzStartPage(Sender: TCustomQuickRep);
var
i: integer;
begin
for I := 0 to PageHeaderBand1.ControlCount - 1 do //設(shè)置頁頭的套打
begin
if PageHeaderBand1.Controls[I] is TQRLabel then
begin
if Tao_Print_Flag then
begin
TQRLabel(PageHeaderBand1.Controls[I]).Enabled := False;
if (PageHeaderBand1.Controls[I].Name = 'QRLabel1') then
TQRLabel(PageHeaderBand1.Controls[I]).Enabled := True;
end
else
TQRLabel(PageHeaderBand1.Controls[I]).Enabled := True;
end;
if PageHeaderBand1.Controls[I] is TQRShape then
if Tao_Print_Flag then
TQRShape(PageHeaderBand1.Controls[i]).Enabled := False
else
TQRShape(PageHeaderBand1.Controls[i]).Enabled := True;
end;
for I := 0 to ColumnHeaderBand1.ControlCount - 1 do //設(shè)置表頭的套打
begin
if ColumnHeaderBand1.Controls[I] is TQRShape then
begin
if Tao_Print_Flag then
TQRShape(ColumnHeaderBand1.Controls[I]).Enabled := False
else
TQRShape(ColumnHeaderBand1.Controls[I]).Enabled := True;
end;
if ColumnHeaderBand1.Controls[I] is TQRLabel then
begin
if Tao_Print_Flag then
TQRLabel(ColumnHeaderBand1.Controls[I]).Enabled := False
else
TQRLabel(ColumnHeaderBand1.Controls[I]).Enabled := True;
end;
if QRe_jypzz.QRPrinter.PageNumber = 1 then
QRLabel13.Enabled := False
else
QRLabel13.Enabled := True;
end;
for I := 0 to DetailBand1.ControlCount - 1 do //設(shè)置表內(nèi)容的套打
begin
if DetailBand1.Controls[I] is TQRShape then
begin
if Tao_Print_Flag then
TQRShape(DetailBand1.Controls[I]).Enabled := False
else
TQRShape(DetailBand1.Controls[I]).Enabled := True;
end;
end;
for i := 0 to PageFooterBand1.ControlCount - 1 do //設(shè)置頁尾的套打
begin
if PageFooterBand1.Controls[I] is TQRLabel then
begin
if QRe_jypzz.QRPrinter.PageNumber = TotalPageCount then
TQRLabel(PageFooterBand1.Controls[I]).Enabled := False
else
TQRLabel(PageFooterBand1.Controls[I]).Enabled := True;
end;
if PageFooterBand1.Controls[I] is TQRShape then
begin
if Tao_Print_Flag then
TQRShape(PageFooterBand1.Controls[I]).enabled := False
else
TQRShape(PageFooterBand1.Controls[I]).Enabled := True;
end;
end;
end;
procedure TfrmY_JYPPZZCX.QRe_jypzzBeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
begin
Qry_Print.First;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -