📄 fee_balance_r.pas
字号:
unit Fee_Balance_R;
interface
uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
StdCtrls, ExtCtrls, Forms, Quickrpt, QRCtrls;
type
TR_Fee_Balance = class(TQuickRep)
DetailBand1: TQRBand;
QRLS_HouseName: TQRLabel;
QRLS_HouseNo: TQRLabel;
QRL_Title: TQRLabel;
QRLS_BoxNo: TQRLabel;
QRLS_Address: TQRLabel;
QRLS_Voltage: TQRLabel;
QRLS_Line: TQRLabel;
QRLS_AmmeterNo: TQRLabel;
QRLS_LastCount: TQRLabel;
QRLabel12: TQRLabel;
QRLabel13: TQRLabel;
QRLabel14: TQRLabel;
QRL_Rate: TQRLabel;
QRLabel16: TQRLabel;
QRLabel17: TQRLabel;
QRLabel18: TQRLabel;
QRLabel19: TQRLabel;
QRLabel20: TQRLabel;
QRLS_TradeNo: TQRLabel;
QRLabel22: TQRLabel;
QRLabel23: TQRLabel;
QRLabel24: TQRLabel;
QRLabel25: TQRLabel;
QRLabel26: TQRLabel;
QRLabel27: TQRLabel;
QRLabel28: TQRLabel;
QRLabel29: TQRLabel;
QRLabel30: TQRLabel;
QRLabel31: TQRLabel;
QRLabel32: TQRLabel;
QRLabel33: TQRLabel;
QRLabel35: TQRLabel;
QRShape1: TQRShape;
QRShape2: TQRShape;
QRShape3: TQRShape;
QRShape4: TQRShape;
QRShape5: TQRShape;
QRShape6: TQRShape;
QRShape7: TQRShape;
QRLabel36: TQRLabel;
QRLabel37: TQRLabel;
QRLabel38: TQRLabel;
QRLabel39: TQRLabel;
QRLS_ThisCount: TQRLabel;
QRLabel10: TQRLabel;
QRShape9: TQRShape;
QRLabel45: TQRLabel;
QRLabel46: TQRLabel;
QRLabel47: TQRLabel;
QRLabel48: TQRLabel;
QRL_Month: TQRLabel;
QRDBText1: TQRDBText;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
QRL_Add: TQRLabel;
QRLabel51: TQRLabel;
QRDBText21: TQRDBText;
QRL_Line: TQRLabel;
QRDBText23: TQRDBText;
QRL_Ammeter_no1: TQRLabel;
QRL_Ammeter_No2: TQRLabel;
QRL_Ammeter_No3: TQRLabel;
QRL_Last3: TQRLabel;
QRL_Last2: TQRLabel;
QRL_Last1: TQRLabel;
QRL_Count1: TQRLabel;
QRL_Count2: TQRLabel;
QRL_Count3: TQRLabel;
QRDBText7: TQRDBText;
QRDBText8: TQRDBText;
QRDB_Rate1: TQRDBText;
QRDB_Rate2: TQRDBText;
QRM_Note: TQRMemo;
QRDBText22: TQRDBText;
QRDB_Count: TQRDBText;
QRDB_Count1: TQRDBText;
QRDB_Count2: TQRDBText;
QRExpr1: TQRExpr;
QRL_Country_Price1: TQRLabel;
QRL_Country_Price2: TQRLabel;
QRL_Country_Price3: TQRLabel;
QRDBText6: TQRDBText;
QRL_Country_Amount1: TQRLabel;
QRL_Country_Amount2: TQRLabel;
QRL_Country_Amount3: TQRLabel;
QRL_ExcessAmount: TQRLabel;
QRL_Country_Amount: TQRLabel;
QRSysData1: TQRSysData;
QRL_Fee: TQRLabel;
QRL_Comput: TQRLabel;
QRL_Auditing: TQRLabel;
QRL_Amount: TQRLabel;
QRLS_Voltage1: TQRLabel;
QRLabel7: TQRLabel;
QRLabel50: TQRLabel;
QRDB_Arrearage: TQRDBText;
QRDBText4: TQRDBText;
QRShape11: TQRShape;
QRShape10: TQRShape;
QRLabel52: TQRLabel;
QRDBText5: TQRDBText;
QRDBText9: TQRDBText;
QRL_ExcessCount: TQRLabel;
QRL_ExcessScale: TQRLabel;
QRL_ExcessPrice: TQRLabel;
procedure DetailBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
procedure R_Fee_Balance_EmptyAfterPrint(Sender: TObject);
procedure DetailBand1AfterPrint(Sender: TQRCustomBand;
BandPrinted: Boolean);
procedure QRDB_Rate1Print(sender: TObject; var Value: String);
procedure QuickRepBeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
procedure QRDB_ArrearagePrint(sender: TObject; var Value: String);
procedure QRDBText4Print(sender: TObject; var Value: String);
procedure QRDBText9Print(sender: TObject; var Value: String);
procedure QRL_ExcessCountPrint(sender: TObject; var Value: String);
procedure QRL_ExcessScalePrint(sender: TObject; var Value: String);
procedure QRL_ExcessPricePrint(sender: TObject; var Value: String);
private
CoverPrint:boolean;//套打标志
public
Procedure SetCoverPrint(bCoverPrint:boolean);//设置是否要套打
end;
var
R_Fee_Balance: TR_Fee_Balance;
implementation
uses CommSmdljf, Table_DM, Comm, Variants;
{$R *.DFM}
var
nHouseCount:Integer;//户数
procedure TR_Fee_Balance.DetailBand1BeforePrint(
Sender: TQRCustomBand; var PrintBand: Boolean);
var
//三块表的表号,上次抄表数,本次抄表数
A_No1, A_No2, A_No3:String;
A_Last1, A_Last2, A_Last3:Extended;
A_Count1, A_Count2, A_Count3:Extended;
//农网维护费,单价
// V_Service_Fee, V_Service_Price:Extended;
v_Service_Price1, v_Service_Price2, v_Service_Price3, v_Service_Price4: Extended;
v_Service_Amount1, v_Service_Amount2, v_Service_Amount3, v_Service_Amount4: Extended;
v_Service_Amount: Extended;
//国家价
v_Country_Price1, v_Country_Price2, v_Country_Price3, v_Country_Price4: Extended;
v_Country_Amount1, v_Country_Amount2, v_Country_Amount3, v_Country_Amount4: Extended;
v_Country_Amount: Extended;
//滞纳金
// v_LateFee: Extended;
//用户编号
V_House_No:String;
begin
if CoverPrint Then
QRL_Title.Caption := StationName
Else
QRL_Title.Caption := CorpName+StationName+'电费结算单';
If IronMode Then//只有加铁损结算时有变耗
Begin
QRLabel52.Enabled := True;
QRDBText5.Enabled := True;
End
Else
Begin
QRLabel52.Enabled := False;
QRDBText5.Enabled := False;
End;
//以下总价套打时不打印
//================================================================================
QRLS_HouseNo.Enabled := Not CoverPrint;
QRLS_BoxNo.Enabled := Not CoverPrint;
QRLS_HouseName.Enabled := Not CoverPrint;
QRLS_Address.Enabled := Not CoverPrint;
QRLS_Voltage.Enabled := Not CoverPrint;
QRLS_Voltage1.Enabled := Not CoverPrint;
QRLS_TradeNo.Enabled := Not CoverPrint;
QRLS_Line.Enabled := Not CoverPrint;
QRLS_AmmeterNo.Enabled := Not CoverPrint;
QRLS_LastCount.Enabled := Not CoverPrint;
QRLS_ThisCount.Enabled := Not CoverPrint;
QRL_Rate.Enabled := Not CoverPrint;
QRLabel13.Enabled := Not CoverPrint;
QRLabel16.Enabled := Not CoverPrint;
QRLabel14.Enabled := Not CoverPrint;
QRLabel12.Enabled := Not CoverPrint;
QRLabel22.Enabled := Not CoverPrint;
QRLabel23.Enabled := Not CoverPrint;
QRLabel24.Enabled := Not CoverPrint;
// QRLabel45.Enabled := Not CoverPrint;
QRLabel19.Enabled := Not CoverPrint;
QRLabel25.Enabled := Not CoverPrint;
QRLabel26.Enabled := Not CoverPrint;
QRLabel27.Enabled := Not CoverPrint;
// QRLabel47.Enabled := Not CoverPrint;
QRLabel17.Enabled := Not CoverPrint;
QRLabel20.Enabled := Not CoverPrint;
QRLabel28.Enabled := Not CoverPrint;
QRLabel29.Enabled := Not CoverPrint;
// QRLabel47.Enabled := Not CoverPrint;
QRLabel18.Enabled := Not CoverPrint;
QRLabel30.Enabled := Not CoverPrint;
QRLabel31.Enabled := Not CoverPrint;
QRLabel32.Enabled := Not CoverPrint;
// QRLabel48.Enabled := Not CoverPrint;
QRLabel36.Enabled := Not CoverPrint;
// QRLabel41.Enabled := Not CoverPrint;
// QRLabel44.Enabled := Not CoverPrint;
// QRLabel46.Enabled := Not CoverPrint;
// QRLabel42.Enabled := Not CoverPrint;
// QRLabel34.Enabled := Not CoverPrint;
// QRLabel49.Enabled := Not CoverPrint;
QRLabel33.Enabled := Not CoverPrint;
QRLabel35.Enabled := Not CoverPrint;
QRLabel50.Enabled := Not CoverPrint;
QRLabel7.Enabled := Not CoverPrint;
// QRLabel43.Enabled := Not CoverPrint;
QRLabel37.Enabled := Not CoverPrint;
QRLabel38.Enabled := Not CoverPrint;
QRLabel39.Enabled := Not CoverPrint;
QRLabel10.Enabled := Not CoverPrint;
QRShape1.Enabled := Not CoverPrint;
QRShape2.Enabled := Not CoverPrint;
QRShape3.Enabled := Not CoverPrint;
QRShape4.Enabled := Not CoverPrint;
QRShape5.Enabled := Not CoverPrint;
QRShape6.Enabled := Not CoverPrint;
QRShape7.Enabled := Not CoverPrint;
QRShape9.Enabled := Not CoverPrint;
QRShape10.Enabled := Not CoverPrint;
QRShape11.Enabled := Not CoverPrint;
//================================================================================
QRL_Comput.Caption := Default_Comput;
QRL_Auditing.Caption := Default_Auditing;
QRL_Fee.Caption := Default_Fee;
QRL_Month.Caption := CurrentYear+' 年 '+CurrentMonth+' 月份';
//通过用户编号得到用户地址和线路
V_House_No := Dm_Table.V_House['F_House_No'];
QRL_Add.Caption := F_GetAddress(V_House_No);
QRL_Line.Caption := F_GetLine(V_House_No);
//得到指定用户相关表的信息
P_GetAmmeter(V_House_No,A_No1,A_No2,A_No3,
A_Last1,A_Last2,A_Last3,
A_Count1,A_Count2,A_Count3);
QRL_Ammeter_No1.Caption := Trim(A_No1);
QRL_Last1.Caption := F_FloatToStrF(A_Last1,10,-1);
If A_Count1 < 0 Then
QRL_Count1.Caption := '未抄'
Else
QRL_Count1.Caption := F_FloatToStrF(A_Count1,10,-1);
QRL_Ammeter_No2.Caption := Trim(A_No2);
QRL_Last2.Caption := '';
QRL_Count2.Caption := '';
QRL_Last3.Caption := '';
QRL_Count3.Caption := '';
If Trim(A_No2) <> '' Then
Begin
QRL_Last2.Caption := F_FloatToStrF(A_Last2,10,-1);
If A_Count2 < 0 Then
QRL_Count2.Caption := '未抄'
Else
QRL_Count2.Caption := F_FloatToStrF(A_Count2,10,-1);
End;
QRL_Ammeter_No3.Caption := Trim(A_No3);
If Trim(A_No3) <> '' Then
Begin
QRL_Last3.Caption := F_FloatToStrF(A_Last3,10,-1);
If A_Count3 < 0 Then
QRL_Count3.Caption := '未抄'
Else
QRL_Count3.Caption := F_FloatToStrF(A_Count3,10,-1);
End;
//打印备注栏
QRM_Note.Lines.Clear();
If Dm_Table.V_House['F_Note'] <> Null Then
QRM_Note.Lines.Add(F_Warp(Dm_Table.V_House['F_Note']))
Else
QRM_Note.Lines.Add('');
//求农网维护费和国家费
With Dm_Table Do
Begin
p_GetService(V_House['F_House_No'],
v_Service_Price1, v_Service_Price2, v_Service_Price3, v_Service_Price4,
v_Service_Amount1, v_Service_Amount2, v_Service_Amount3, v_Service_Amount4,
v_Service_Amount);
// QRL_Service_Amount1.Caption := F_FloatToStrF(V_Service_Amount1,10,2);
// QRL_Service_Amount2.Caption := F_FloatToStrF(V_Service_Amount2,10,2);
// QRL_Service_Amount3.Caption := F_FloatToStrF(V_Service_Amount3,10,2);
// QRL_Service_Amount4.Caption := F_FloatToStrF(V_Service_Amount4,10,2);
// QRL_Service_Amount.Caption := F_FloatToStrF(V_Service_Amount,10,2);
p_GetCountry(V_House['F_House_No'],
v_Country_Price1, v_Country_Price2, v_Country_Price3, v_Country_Price4,
v_Country_Amount1, v_Country_Amount2, v_Country_Amount3, v_Country_Amount4,
v_Country_Amount);
QRL_Country_Price1.Caption := F_FloatToStrF(V_Country_Price1,10,3);
QRL_Country_Price2.Caption := F_FloatToStrF(V_Country_Price2,10,3);
QRL_Country_Price3.Caption := F_FloatToStrF(V_Country_Price3,10,3);
// QRL_Country_Price4.Caption := F_FloatToStrF(V_Country_Price4,10,3);
QRL_Country_Amount1.Caption := F_FloatToStrF(V_Country_Amount1,10,2);
QRL_Country_Amount2.Caption := F_FloatToStrF(V_Country_Amount2,10,2);
QRL_Country_Amount3.Caption := F_FloatToStrF(V_Country_Amount3,10,2);
// QRL_Country_Amount4.Caption := F_FloatToStrF(V_Country_Amount4,10,2);
End;
//求加价电量比例、单价、电费等
QRL_ExcessScale.Caption := '';
QRL_ExcessPrice.Caption := '';
if DM_Table.v_House['f_ExcessType'] <> Null Then
Begin
DM_Table.Query.Close();
DM_Table.Query.SQL.Text := Format('Select f_ExcessScale, f_ExcessPrice From Tb_Excess Where f_ExcessType = %s',[DM_Table.v_House['f_ExcessType']]);
DM_Table.Query.Open();
QRL_ExcessScale.Caption := DM_Table.Query.FieldByName('f_ExcessScale').AsString;
QRL_ExcessPrice.Caption := DM_Table.Query.FieldByName('f_ExcessPrice').AsString;
End;
DM_Table.Query.Close();
DM_Table.Query.SQL.Text := Format('Select f_ExcessCount, f_ExcessAmount, f_Amount From Tb_Fee Where f_House_No = ''%s''',[DM_Table.v_House['f_House_No']]);
DM_Table.Query.Open();
QRL_ExcessCount.Caption := DM_Table.Query.FieldByName('f_ExcessCount').AsString;
QRL_ExcessAmount.Caption := F_FloatToStrF(DM_Table.Query.FieldByName('f_ExcessAmount').AsFloat, 10, 2);
//应收金额
QRL_Amount.Caption := F_FloatToStrF(DM_Table.Query.FieldByName('f_Amount').AsFloat, 10,2);
//电费合计=加价电费 + 国价费
QRL_Country_Amount.Caption := F_FloatToStrF(V_Country_Amount + DM_Table.Query.FieldByName('f_ExcessAmount').AsFloat,10,2);
If (QRL_ExcessScale.Caption = '') Or (QRL_ExcessScale.Caption = '0') Then
Begin
QRLabel45.Enabled := False;
QRLabel46.Enabled := False;
QRLabel47.Enabled := False;
QRLabel48.Enabled := False;
End
Else
Begin
QRLabel45.Enabled := True;
QRLabel46.Enabled := True;
QRLabel47.Enabled := True;
QRLabel48.Enabled := True;
End;
end;
procedure TR_Fee_Balance.R_Fee_Balance_EmptyAfterPrint(
Sender: TObject);
begin
P_Log('打印: 电费结算单。户数'+IntToStr(nHouseCount));
end;
procedure TR_Fee_Balance.DetailBand1AfterPrint(Sender: TQRCustomBand;
BandPrinted: Boolean);
begin
if BandPrinted Then
Inc(nHouseCount);//户数增加
end;
procedure TR_Fee_Balance.QRDB_Rate1Print(sender: TObject;
var Value: String);
begin
Value:= F_FloatToStrF(StrToFloat(Value) * 100, 0, 0);
If Value <> '' Then
Value := Value + ' %'
end;
procedure TR_Fee_Balance.QuickRepBeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
begin
nHouseCount := 0;//户数初始为零
end;
procedure TR_Fee_Balance.QRDB_ArrearagePrint(sender: TObject;
var Value: String);
begin
Value := F_FloatToStrF(StrToFloat(Value),10,2);
end;
procedure TR_Fee_Balance.QRDBText4Print(sender: TObject;
var Value: String);
begin
Value := F_FloatToStrF(StrToFloat(Value),10,2);
end;
procedure TR_Fee_Balance.QRDBText9Print(sender: TObject;
var Value: String);
begin
If StrToInt(Value) <> 1 Then
Value := IntToStr(StrToInt(Value) * 5)
else
Value := '';
end;
procedure TR_Fee_Balance.SetCoverPrint(bCoverPrint:Boolean);
begin
CoverPrint := bCoverPrint;
End;
procedure TR_Fee_Balance.QRL_ExcessCountPrint(sender: TObject;
var Value: String);
begin
If Value = '0' Then
Value := '';
end;
procedure TR_Fee_Balance.QRL_ExcessScalePrint(sender: TObject;
var Value: String);
begin
Value:= F_FloatToStrF(StrToFloat(Value) * 100, 0, 0);
If Value <> '' Then
Value := Value + ' %'
end;
procedure TR_Fee_Balance.QRL_ExcessPricePrint(sender: TObject;
var Value: String);
begin
If Value = '0' Then
Value := '';
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -