📄 mainform.pas
字号:
CEditShiShou.Value:=QueryYiShou.FieldByName('实收金额').AsFloat;
ReadDetail(QueryYiShou);
end;
end;
procedure TFormMain.QueryWDFPAfterScroll(DataSet: TDataSet);
begin
if ChkIdx=2 then begin
if not QueryWDFP.Active then Exit;
if QueryWDFP.RecordCount=0 then Exit;
LabelYSZNJ.Caption:=QueryWDFP.FieldByName('应收滞纳金').AsString;
CurrencyEditZHNJ.Text:=QueryWDFP.FieldByName('实收滞纳金').AsString;
CEditShiShou.Text:=QueryWDFP.FieldByName('实收金额').AsString;
ReadDetail(QueryWDFP);
end;
end;
procedure TFormMain.CEditShiShouExit(Sender: TObject);
begin
if ChkIdx=0 then begin
if (not FenCiShouFei) and (CEditShiShou.Value<StrToFloat(LabelHJ.Caption)) then begin
CEditShiShou.Value:=StrToFloat(LabelHJ.Caption);
ShowORHideZHAOLING(False);
ShowMessage('不允许分次收费!');
Exit;
end;
if CEditShiShou.Value>=StrToFloat(LabelHJ.Caption) then begin
ShowORHideZHAOLING(True);
end;
end;
end;
procedure TFormMain.CEditShiShouKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key=vk_return)and (ChkIdx=0) then begin
if (not FenCiShouFei) and (CEditShiShou.Value<StrToFloat(LabelHJ.Caption)) then begin
CEditShiShou.Value:=StrToFloat(LabelHJ.Caption);
ShowORHideZHAOLING(False);
ShowMessage('不允许分次收费!');
Exit;
end;
if CEditShiShou.Value>=StrToFloat(LabelHJ.Caption) then begin
ShowORHideZHAOLING(True);
end;
end;
end;
procedure TFormMain.ToolButtonWSHClick(Sender: TObject);
begin
ChkIdx:=0;
DataSourceGrid.DataSet:=QueryMain;
EnableButtons;
ResetValue;
if QueryMain.Active then
QueryMain.First;
QueryMainAfterScroll(nil);
if(ToolButtonSelPrn.Down)and(not (dgRowSelect in DBGridMain.Options)) then
DBGridMain.Options:=DBGridMain.Options+[dgRowSelect];
end;
procedure TFormMain.ToolButtonYSHClick(Sender: TObject);
begin
if dgRowSelect in DBGridMain.Options then
DBGridMain.Options:=DBGridMain.Options-[dgRowSelect];
FormOpDate:=TFormOpDate.Create(Self);
if FormOpDate.ShowModal=mrOK then begin
ChkIdx:=1;
try
if RecallSqlLst.Strings[2]='' then begin
if Abs(FormOpDate.DateT-FormOpDate.DateF)>1 then
OpenQueryProc(RecallSqlLst[0]+RecallSqlLst[1]+' where 发票已打=''T'' and 收费日期 between '''+FormatDateTime('mm/dd/yyyy',FormOpDate.DateF)+''' and '''+FormatDateTime('mm/dd/yyyy',FormOpDate.DateT)+''' '+RecallSqlLst[3]+RecallSqlLst[4],QueryYiShou)
else
OpenQueryProc(RecallSqlLst[0]+RecallSqlLst[1]+' where 发票已打=''T'' and datediff(dd,收费日期,'''+FormatDateTime('mm/dd/yyyy',FormOpDate.DateF)+''')=0 '+RecallSqlLst[3]+RecallSqlLst[4],QueryYiShou);
end
else begin
if Abs(FormOpDate.DateT-FormOpDate.DateF)>1 then
OpenQueryProc(RecallSqlLst[0]+RecallSqlLst[1]+RecallSqlLst[2]+' and 发票已打=''T'' and 收费日期 between '''+FormatDateTime('mm/dd/yyyy',FormOpDate.DateF)+''' and '''+FormatDateTime('mm/dd/yyyy',FormOpDate.DateT)+''' '+RecallSqlLst[3]+RecallSqlLst[4],QueryYiShou)
else
OpenQueryProc(RecallSqlLst[0]+RecallSqlLst[1]+RecallSqlLst[2]+' and 发票已打=''T'' and datediff(dd,收费日期,'''+FormatDateTime('mm/dd/yyyy',FormOpDate.DateF)+''')=0 '+RecallSqlLst[3]+RecallSqlLst[4],QueryYiShou);
end;
DBGridFldRef(QueryYiShou);
DataSourceGrid.DataSet:=QueryYiShou;
EnableButtons;
ResetValue;
QueryYiShouAfterScroll(nil);
except
FormOpDate.Free;
RadioButtonWSH.Down:=True;
end;
FormOpDate.Free;
end
else begin
FormOpDate.Free;
if ChkIdx=0 then begin
RadioButtonWSH.Down:=True;
end
else if ChkIdx=2 then begin
RadioButtonWDFP.Down:=True;
end;
end;
end;
procedure TFormMain.ToolButtonWDFPClick(Sender: TObject);
begin
ChkIdx:=2;
DataSourceGrid.DataSet:=QueryWDFP;
EnableButtons;
ResetValue;
if QueryWDFP.Active then
QueryWDFP.First;
QueryWDFPAfterScroll(nil);
if(ToolButtonSelPrn.Down)and(not (dgRowSelect in DBGridMain.Options)) then
DBGridMain.Options:=DBGridMain.Options+[dgRowSelect];
end;
procedure TFormMain.Menu_PrePayClick(Sender: TObject);
var
ExtAppHandle:THandle;
PExtProc:FarProc;
begin
if HaveThesePower(OpID,'sf_xt_zhanghu','用户预缴')<>1 then begin
ShowMessage('当前帐号没有进入用户预缴的权利!');
Exit;
end;
ExtAppHandle:=LoadLibrary(PChar(ExtAppPath+'YuJiao.dll'));
PreCallDll(ExtAppHandle);
if ExtAppHandle>=32 then begin
try
PExtProc:=GetProcAddress(ExtAppHandle,PChar('DLL_Open'));
Screen.Cursor:=crDefault;
if PExtProc<>nil then
TVoidProc(PExtProc);
PExtProc:=GetProcAddress(ExtAppHandle,'DLL_Destory');
if PExtProc<>nil then
TVoidProc(PExtProc);
except
on e:Exception do
ShowMessage(e.Message);
end;
FreeLibrary(ExtAppHandle);
end
else
ShowMessage('不能加载预缴模块');
end;
procedure TFormMain.CurrencyEditZHNJKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
FormatStr: String;
begin
if QUZHENGWS=0 then
FormatStr:='0'
else
FormatStr:='0.0';
if YuEisNegative then begin
////多收的本月余额用负数表示供电局欠用户
//用户应缴=应收金额+上月余额+滞纳金-用户已缴-预存金额
if JINEQUZHENG then
LabelHJ.Caption:=FormatFloat(FormatStr,StrToFloat(LabelYSJE.Caption)
+StrtoFloat(LabelSYYE.Caption)
+CurrencyEditZHNJ.Value-StrToFloat(LabelYJ.Caption)-StrToFloat(LabelYC.Caption))
else
LabelHJ.Caption:=FloatToStr(StrToFloat(LabelYSJE.Caption)
+StrtoFloat(LabelSYYE.Caption)
+CurrencyEditZHNJ.Value-StrToFloat(LabelYJ.Caption)-StrToFloat(LabelYC.Caption));
end
else begin
////多收的本月余额用正数表示供电局欠用户
//用户应缴=应收金额+滞纳金-用户已缴-预存金额-上月余额
if JINEQUZHENG then
LabelHJ.Caption:=FormatFloat(FormatStr,StrToFloat(LabelYSJE.Caption)
+CurrencyEditZHNJ.Value
-StrToFloat(LabelYJ.Caption)-StrToFloat(LabelYC.Caption)
-StrtoFloat(LabelSYYE.Caption))
else
LabelHJ.Caption:=FloatToStr(StrToFloat(LabelYSJE.Caption)
+CurrencyEditZHNJ.Value
-StrToFloat(LabelYJ.Caption)-StrToFloat(LabelYC.Caption)
-StrtoFloat(LabelSYYE.Caption));
end;
CEditShiShou.Value:=StrtoFloat(LabelHJ.Caption);
end;
procedure TFormMain.PreCallDll(DllHandle: THandle);
var
PExtProc : FarProc;
CntString : String;
HuHao,LSH : String;
YongHuID,ShouFeiXH : Integer;
begin
if DllHandle>=32 then
try
PExtProc:=GetProcAddress(DllHandle,'DLL_Create');
if PExtProc<>nil then
TDllCreate(PExtProc)(Application.Handle);
PExtProc:=GetProcAddress(DllHandle,'DLL_InitDatabase');
if PExtProc<>nil then begin
CntString:=DataMD.ADOConnection.ConnectionString;
YongHuID:=-1;ShouFeiXH:=-1;
case ChkIdx of
0:begin
if QueryMain.Active then
if QueryMain.RecordCount>0 then begin
HuHao:=QueryMain.FieldByName('户号').AsString;
YongHuID:=QueryMain.FieldByName('ID').AsInteger;
LSH:=QueryMain.FieldByName('流水号').AsString;
end;
end;
1:begin
if QueryYiShou.Active then
if QueryYiShou.RecordCount>0 then begin
HuHao:=QueryYiShou.FieldByName('户号').AsString;
LSH:=QueryYiShou.FieldByName('流水号').AsString;
YongHuID:=QueryYiShou.FieldByName('ID').AsInteger;
ShouFeiXH:=QueryYiShou.FieldByName('收费序号').AsInteger;
end;
end;
2:begin
if QueryWDFP.Active then
if QueryWDFP.RecordCount>0 then begin
HuHao:=QueryWDFP.FieldByName('户号').AsString;
LSH:=QueryWDFP.FieldByName('流水号').AsString;
YongHuID:=QueryWDFP.FieldByName('ID').AsInteger;
ShouFeiXH:=QueryWDFP.FieldByName('收费序号').AsInteger;
end;
end;
end;
TDllInitDb(PExtProc)(PChar(CntString),PChar(HuHao),PChar(LSH),PChar(OpName),YongHuID,ShouFeiXH,OpID);
end;
except
on e:Exception do
ShowMessage(e.Message);
end;
end;
procedure TFormMain.Menu_DataInClick(Sender: TObject);
var
ExtAppHandle:THandle;
PExtProc:FarProc;
begin
if HaveThesePower(OpID,'sf_xt_zhanghu','收费管理')<>1 then begin
ShowMessage('当前帐号没有进入数据导入的权利!');
Exit;
end;
ExtAppHandle:=LoadLibrary(PChar(ExtAppPath+'ImportData.dll'));
PreCallDll(ExtAppHandle);
if ExtAppHandle>=32 then begin
try
PExtProc:=GetProcAddress(ExtAppHandle,PChar('DLL_Open'));
Screen.Cursor:=crDefault;
if PExtProc<>nil then
TVoidProc(PExtProc);
PExtProc:=GetProcAddress(ExtAppHandle,'DLL_Destory');
if PExtProc<>nil then
TVoidProc(PExtProc);
except
on e:Exception do
ShowMessage(e.Message);
end;
FreeLibrary(ExtAppHandle);
end
else
ShowMessage('不能加载导入模块');
end;
procedure TFormMain.Menu_DataZuoFeiClick(Sender: TObject);
var
ExtAppHandle:THandle;
PExtProc:FarProc;
begin
if HaveThesePower(OpID,'sf_xt_zhanghu','收费管理')<>1 then begin
ShowMessage('当前帐号没有进入作废收费的权利!');
Exit;
end;
if ChkIdx=1 then begin
ShowMessage('请先作废发票!');
Exit;
end;
ExtAppHandle:=LoadLibrary(PChar(ExtAppPath+'ZuoFeiData.dll'));
PreCallDll(ExtAppHandle);
if ExtAppHandle>=32 then begin
try
PExtProc:=GetProcAddress(ExtAppHandle,PChar('DLL_ZuoFei'));
Screen.Cursor:=crDefault;
if PExtProc<>nil then
TVoidProc(PExtProc);
PExtProc:=GetProcAddress(ExtAppHandle,'DLL_Destory');
if PExtProc<>nil then
TVoidProc(PExtProc);
except
on e:Exception do
ShowMessage(e.Message);
end;
FreeLibrary(ExtAppHandle);
end
else
ShowMessage('不能加载作废模块');
end;
procedure TFormMain.QueryMainAfterClose(DataSet: TDataSet);
begin
ResetCtrls;
end;
procedure TFormMain.QueryYiShouAfterClose(DataSet: TDataSet);
begin
ResetCtrls;
end;
procedure TFormMain.QueryWDFPAfterClose(DataSet: TDataSet);
begin
ResetCtrls;
end;
procedure TFormMain.ShowORHideZHAOLING(IsShow: Boolean);
begin
if IsShow then begin
LabelZHL.Caption:=FloatToStr(CEditShiShou.Value-StrToFloat(LabelHJ.Caption));
Label3.Visible:=True;
LabelZHL.Visible:=True;
CheckBox1.Visible:=(not (LabelZHL.Caption='0')) and YuShouFei;
end
else begin
Label3.Visible:=False;
LabelZHL.Visible:=False;
CheckBox1.Visible:=False;
end;
end;
procedure TFormMain.CEditShiShouEnter(Sender: TObject);
begin
EditHuHao.Text:='';
end;
procedure TFormMain.FormResize(Sender: TObject);
begin
if Self.Height>700 then
PageControl.Height:=515
else
PageControl.Height:=355;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -