charge_report_10kv_f.pas

来自「县级供电企业电费核算源码, 在客户处正常运行8年以上, Delphi 5开发,数」· PAS 代码 · 共 156 行

PAS
156
字号
unit Charge_Report_10KV_F;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Db, DBTables, Grids, DBGrids, StdCtrls, ComCtrls, ExtCtrls, ppDB,
  ppDBPipe, ppParameter, ppVar, ppBands, ppReport, ppStrtch, ppSubRpt,
  ppCtrls, ppPrnabl, ppClass, ppCache, ppComm, ppRelatv, ppProd, ppEndUsr;

type
  TF_Charge_Report_10KV = class(TForm)
    PC_Charge: TPageControl;
    Ts_400V: TTabSheet;
    DBG_400V: TDBGrid;
    Panel1: TPanel;
    Panel2: TPanel;
    Bt_Close: TButton;
    Panel3: TPanel;
    Bt_Calc: TButton;
    Bt_Print: TButton;
    RB_Charged: TRadioButton;
    Rb_UnCharged: TRadioButton;
    Rb_All: TRadioButton;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    DTP_Start: TDateTimePicker;
    Label3: TLabel;
    DTP_End: TDateTimePicker;
    CB_AllReceiver: TCheckBox;
    R_10KV: TppReport;
    DBP_10KV: TppDBPipeline;
    D_10KV: TppDesigner;
    Bt_Edit: TButton;
    ppParameterList1: TppParameterList;
    ppHeaderBand1: TppHeaderBand;
    ppLabel1: TppLabel;
    ppLabel2: TppLabel;
    ppLabel3: TppLabel;
    ppLabel4: TppLabel;
    ppLabel8: TppLabel;
    ppLabel9: TppLabel;
    ppLine2: TppLine;
    ppLine3: TppLine;
    ppLine4: TppLine;
    ppLine5: TppLine;
    ppLine12: TppLine;
    ppDetailBand1: TppDetailBand;
    ppDBText1: TppDBText;
    ppDBText2: TppDBText;
    ppDBText3: TppDBText;
    ppDBText4: TppDBText;
    ppDBText8: TppDBText;
    ppLine1: TppLine;
    ppLine7: TppLine;
    ppLine8: TppLine;
    ppLine9: TppLine;
    ppLine10: TppLine;
    ppFooterBand1: TppFooterBand;
    ppSummaryBand1: TppSummaryBand;
    ppDBCalc3: TppDBCalc;
    ppLine16: TppLine;
    ppLabel6: TppLabel;
    ppDBCalc1: TppDBCalc;
    procedure Bt_CalcClick(Sender: TObject);
    procedure Bt_CloseClick(Sender: TObject);
    procedure Bt_PrintClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Bt_EditClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  F_Charge_Report_10KV: TF_Charge_Report_10KV;

implementation

uses
	CommSmdljf, CommFee, DataModule_10KV;

{$R *.DFM}

procedure TF_Charge_Report_10KV.Bt_CalcClick(Sender: TObject);
Var
    StartDate, EndDate: String[10];
    SqlStr: String;
begin
	StartDate := DateToStr(DTP_Start.Date);
    EndDate := DateToStr(DTP_End.Date);

	DM_10KV.Q_10KVGathering.Close();
//ShowMessage('Wait...');
	DM_10KV.Q_10KVGathering.SQL.Clear();
	DM_10KV.Q_10KVGathering.SQL.Add('Select *');
    DM_10KV.Q_10KVGathering.SQL.Add(' From Tb_10KV_Gathering');
	SqlStr := '';
    If RB_Charged.Checked Then//已缴费统计
    Begin
	    SqlStr := Format(' f_Charge_Date Between ''%s'' And ''%s''',[StartDate, EndDate]);
    	If Not CB_AllReceiver.Checked Then//不是全部收款人
    		SqlStr := SqlStr + Format(' And f_Receiver = ''%s''',[LoginNo]);
    End;
//    Else If RB_UnCharged.Checked Then//未交费用户统计
//	    SqlStr := ' f_Charge_Date Is Null'
//	Else If RB_All.Checked Then//全部用户
//	    SqlStr := '';
    If SqlStr <> '' Then
    Begin
    	SqlStr := ' Where ' + SqlStr;
        DM_10KV.Q_10KVGathering.SQL.Add(SqlStr);
    End;
	DM_10KV.Q_10KVGathering.SQL.Add(' Order By f_House_No');
    DM_10KV.Q_10KVGathering.Open();
end;

procedure TF_Charge_Report_10KV.Bt_CloseClick(Sender: TObject);
begin
	Close();
end;

procedure TF_Charge_Report_10KV.Bt_PrintClick(Sender: TObject);
begin
	R_10KV.Template.FileName := gRootPath + '10KV收费明细.RTM';
    R_10KV.Template.LoadFromFile();
    R_10KV.Print();
end;

procedure TF_Charge_Report_10KV.FormCreate(Sender: TObject);
begin
	DTP_Start.DateTime := Now();
    DTP_End.DateTime := Now();
end;

procedure TF_Charge_Report_10KV.Bt_EditClick(Sender: TObject);
begin
    R_10KV.Template.FileName := gRootPath + '10KV收费明细.RTM';
    R_10KV.Template.LoadFromFile();
    D_10KV.ShowModal();
    If R_10KV.Modified Then
        If Application.MessageBox('报表已被修改, 存储报表?','系统提示',MB_YESNO) = IDYES Then
            R_10KV.Template.SaveToFile();
end;

procedure TF_Charge_Report_10KV.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
	MyReleaseForm(TForm(F_Charge_Report_10KV));
end;

end.

⌨️ 快捷键说明

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