📄 main.pas
字号:
if not DM.CheckRights(4) then Exit;
if not DM.CheckAccountStartedOperation then Exit;
Edited:=false;
Added:=false;
Deleted:=false;
fcpd:=TFrmCashPD.Create(self);
fcpd.IsGoon:=true;
while fcpd.IsGoon do
begin
fcpd.IsGoon:=false;
fcpd.ShowModal;
if not Edited then Edited:=fcpd.Edited;
if not Added then Added:=fcpd.Added;
if not Deleted then Deleted:=fcpd.Deleted;
end;
fcpd.Destroy;
Log:='处理现金日记,';
if (not Edited) then
Log:=Log+'但未作任何修改。'
else
begin
Log:=Log+'作了:';
if Edited then Log:=Log+'[修改]';
if Added then Log:=Log+'[新增]';
if Deleted then Log:=Log+'[删除]';
Log:=Log+'操作。';
end;
DM.WriteLog(Log);
end;
procedure TFrmMain.M252Click(Sender: TObject);
var
fbpd:TFrmBankPD;
Edited,Added,Deleted:Boolean;
Log:string;
begin
if not DM.CheckRights(5) then Exit;
if not DM.CheckAccountStartedOperation then Exit;
Edited:=false;
Added:=false;
Deleted:=false;
fbpd:=TFrmBankPD.Create(self);
fbpd.IsGoon:=true;
while fbpd.IsGoon do
begin
fbpd.IsGoon:=false;
fbpd.ShowModal;
if not Edited then Edited:=fbpd.Edited;
if not Added then Added:=fbpd.Added;
if not Deleted then Deleted:=fbpd.Deleted;
end;
fbpd.Destroy;
Log:='处理银行日记,';
if (not Edited) then
Log:=Log+'但未作任何修改。'
else
begin
Log:=Log+'作了:';
if Edited then Log:=Log+'[修改]';
if Added then Log:=Log+'[新增]';
if Deleted then Log:=Log+'[删除]';
Log:=Log+'操作。';
end;
DM.WriteLog(Log);
end;
procedure TFrmMain.Image16Click(Sender: TObject);
begin
p2.Visible:=False; p3.Visible:=False; p1.Visible:=True;
end;
procedure TFrmMain.Image17Click(Sender: TObject);
begin
p1.Visible:=False; p3.Visible:=False; p2.Visible:=True;
end;
procedure TFrmMain.Image18Click(Sender: TObject);
var
i:integer;
begin
if not DM.CheckRights(7) then Exit;
if not DM.CheckAccountStartedOperation then Exit;
p1.Visible:=False; p2.Visible:=False; p3.Visible:=True;
cbReportYear.Items.Clear;
for i:=DM.AccountStartYear to DM.AccountYear do cbReportYear.Items.Add(IntToStr(i));
cbReportYear.ItemIndex:=cbReportYear.Items.Count-1;
cbReportMonth.ItemIndex:=DM.AccountMonth-1;
if DM.CarryForwardInterval='年' then
begin
ckYearReport.Checked:=true;
cbReportMonth.Enabled:=false;
end
else
begin
ckYearReport.Checked:=false;
cbReportMonth.Enabled:=true;
end;
end;
procedure TFrmMain.Image2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
TImage(Sender).Top:=TImage(Sender).Top+1;
TImage(Sender).Left:=TImage(Sender).Left+1;
end;
procedure TFrmMain.Image2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
TImage(Sender).Top:=TImage(Sender).Top-1;
TImage(Sender).Left:=TImage(Sender).Left-1;
end;
procedure TFrmMain.M53Click(Sender: TObject);
begin
Frm_About(DM.SoftName+' V'+DM.SoftVersionNumber,DM.SoftName2,DM.DeptName);
end;
procedure TFrmMain.M124Click(Sender: TObject);
begin
Frm_ViewLog(DM.adoc,'SystemLog','V_Log',DM.UserRights[0]^);
end;
procedure TFrmMain.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if DM.UserID<>-1 then
if Frm_MsgBox('系统信息','真的要退出本系统吗?',MsgBox_YESNO)=mrNO then CanClose:=false;
end;
procedure TFrmMain.M52Click(Sender: TObject);
begin
if Frm_SoftReg(DM.adoc,'Options','[Value]','[Key]',DM.MID,DM.MID,Fun_NoUnEncryptString(DM.MID+DM.SoftVersionNumber,'SF1-',5,5,0)^,DM.SupperPassword)=mrOK then
begin
DM.SN:=Fun_NoUnEncryptString(DM.MID+DM.SoftVersionNumber,'SF1-',5,5,0)^;
DM.SoftRegState:=true;
FrmMain.Caption:=Copy(FrmMain.Caption,1,Length(FrmMain.Caption)-9);
suiFrmMain.Caption:=FrmMain.Caption;
SetMenuState;
DM.WriteLog('注册软件成功。');
end;
end;
procedure TFrmMain.M51Click(Sender: TObject);
begin
;
end;
procedure TFrmMain.M261Click(Sender: TObject);
begin
if not DM.CheckRights(8) then Exit;
if not DM.CheckAccountStartedOperation then Exit;
tq.Close;
tq.SQL.Clear;
tq.SQL.Add('select top 1 * from Credence where [year]='+IntToStr(DM.AccountYear)+' and [Month]='+IntToStr(DM.AccountMonth)+' and AuditingOperator_id is null');
tq.Open;
if tq.RecordCount>0 then
begin
tq.Close;
Frm_MsgBox('系统信息','本月尚有凭证没有审核,不能结转帐簿!',MsgBox_OK_INFO);
Exit;
end;
tq.Close;
tq.SQL.Clear;
tq.SQL.Add('select top 1 * from Credence where [year]='+IntToStr(DM.AccountYear)+' and [Month]='+IntToStr(DM.AccountMonth));
tq.Open;
if tq.RecordCount<1 then
begin
if Frm_MsgBox('系统信息','本月没有录入任何凭证,确信要结转帐簿吗?',MsgBox_YESNO)=mrNO then
begin
tq.Close;
Exit;
end;
end
else
begin
if Frm_MsgBox('系统信息','确信要结转帐簿吗?',MsgBox_YESNO)=mrNO then
begin
tq.Close;
Exit;
end;
end;
tq.Close;
tq.SQL.Clear;
tq.SQL.Add('exec P_Carryforward '+IntToStr(DM.UserID));
DM.adoc.BeginTrans;
try
tq.ExecSQL;
DM.adoc.CommitTrans;
if DM.AccountMonth=12 then
begin
DM.AccountMonth:=1;
DM.AccountYear:=DM.AccountYear+1;
end
else
DM.AccountMonth:=DM.AccountMonth+1;
sb.Panels[4].Text:='会计期间:'+IntToStr(DM.AccountYear)+'.'+IntToStr(DM.AccountMonth);
DM.WriteLog('结转帐簿至:'+IntToStr(DM.AccountYear)+'.'+IntToStr(DM.AccountMonth));
Frm_MsgBox('系统信息','帐簿结转成功。',MsgBox_OK_INFO);
except
DM.adoc.RollbackTrans;
DM.WriteLog('结转帐簿,但由于未知的故障,操作没有成功。');
Frm_MsgBox('错误信息','帐簿结转操作失败!请与网络管理员联系,检查网络、数据库是否有故障。',MsgBox_OK_ERROR);
end;
tq.Close;
end;
procedure TFrmMain.M262Click(Sender: TObject);
begin
if not DM.CheckRights(8) then Exit;
if not DM.CheckAccountStartedOperation then Exit;
if (DM.AccountYear=DM.AccountStartYear) and (DM.AccountMonth=DM.AccountStartMonth) then
begin
Frm_MsgBox('系统信息','没有上期帐簿结转信息,不能进行反结转。',MsgBox_OK_ERROR);
Exit;
end;
tq.Close;
tq.SQL.Clear;
tq.SQL.Add('select top 1 * from Credence where [year]='+IntToStr(DM.AccountYear)+' and [Month]='+IntToStr(DM.AccountMonth));
tq.Open;
if tq.RecordCount>0 then
begin
tq.Close;
Frm_MsgBox('系统信息','本月已有凭证录入,不能反结转帐簿。提示:如果一定要这么做,请先逐一删除本期所有凭证后再进行反结转。',MsgBox_OK_ERROR);
Exit;
end;
tq.Close;
if Frm_MsgBox('系统信息','确信要反结转帐簿返回到上期吗?',MsgBox_YESNO)=mrNO then
Exit;
tq.SQL.Clear;
tq.SQL.Add('exec P_UnCarryforward');
DM.adoc.BeginTrans;
try
tq.ExecSQL;
DM.adoc.CommitTrans;
if DM.AccountMonth=1 then
begin
DM.AccountMonth:=12;
DM.AccountYear:=DM.AccountYear-1;
end
else
DM.AccountMonth:=DM.AccountMonth-1;
sb.Panels[4].Text:='会计期间:'+IntToStr(DM.AccountYear)+'.'+IntToStr(DM.AccountMonth);
DM.WriteLog('反结转帐簿至:'+IntToStr(DM.AccountYear)+'.'+IntToStr(DM.AccountMonth));
Frm_MsgBox('系统信息','帐簿反结转成功。',MsgBox_OK_INFO);
except
DM.adoc.RollbackTrans;
DM.WriteLog('反结转帐簿,但由于未知的故障,操作没有成功。');
Frm_MsgBox('错误信息','帐簿反结转操作失败!请与网络管理员联系,检查网络、数据库是否有故障。',MsgBox_OK_ERROR);
end;
tq.Close;
end;
procedure TFrmMain.ckYearReportClick(Sender: TObject);
begin
cbReportMonth.Enabled:=not ckYearReport.Checked;
end;
procedure TFrmMain.cbReportMonthChange(Sender: TObject);
begin
if (StrToInt(cbReportYear.Text)=DM.AccountStartYear) and (StrToInt(cbReportMonth.Text)<DM.AccountStartMonth) then
begin
Frm_MsgBox('系统信息','指定的月份帐套没有启动!',MsgBox_OK_ERROR);
cbReportMonth.ItemIndex:=DM.AccountStartMonth-1;
Exit;
end;
if (StrToInt(cbReportYear.Text)=DM.AccountYear) and (StrToInt(cbReportMonth.Text)>DM.AccountMonth) then
begin
Frm_MsgBox('系统信息','帐套没有工作到指定的月份!',MsgBox_OK_ERROR);
cbReportMonth.ItemIndex:=DM.AccountMonth-1;
Exit;
end;
end;
procedure TFrmMain.cbReportNameChange(Sender: TObject);
begin
btnQueryReport.Enabled:=((cbReportName.Text<>'') and (cbReportYear.Text<>'') and ((ckYearReport.Checked) or (cbReportMonth.Text<>'')));
end;
procedure TFrmMain.btnQueryReportClick(Sender: TObject);
var
s:string;
begin
if not DM.CheckSoftReg then Exit;
q_Report.Connection:=DM.adoc;
q_Report.Close;
q_Report.SQL.Clear;
if ckYearReport.Checked then
q_Report.SQL.Add(DM.ReportStoreProcedureName[cbReportName.ItemIndex]+' '+cbReportYear.Text+',-1')
else
q_Report.SQL.Add(DM.ReportStoreProcedureName[cbReportName.ItemIndex]+' '+cbReportYear.Text+','+cbReportMonth.Text);
q_Report.Open;
fr.LoadFromFile(FUN_GetCurrentPath^+DM.ReportFileName[cbReportName.ItemIndex]);
fr.Pages[0].ChangePaper(256,DM.ReportPageWidth[cbReportName.ItemIndex],DM.ReportPageHeight[cbReportName.ItemIndex],-1,poLandscape);
frVariables['DeptName']:=DM.DeptName;
if ckYearReport.Checked then
begin
s:=cbReportYear.Text+'年';
if StrToInt(cbReportYear.Text)=DM.AccountStartYear then
s:=s+IntToStr(DM.AccountStartMonth)+'月-'
else
s:=s+'1月-';
if StrToInt(cbReportYear.Text)=DM.AccountYear then
s:=s+IntToStr(DM.AccountMonth)+'月'
else
s:=s+'12月';
end
else
s:=cbReportYear.Text+'年'+cbReportMonth.Text+'月';
frVariables['ReportDate']:=s;
frVariables['FinanceManager']:=DM.FinanceManager;
frVariables['UserName']:=DM.UserName;
frVariables['PrintDate']:=now;
fr.PrepareReport;
fr.ShowReport;
q_Report.Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -