⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.pas

📁 晓风财务软件源码,具有财务软基本功能,仅供学习,勿商用,后果与本人无关 1、使用的第三方VCL: FastReport2.6中文版 EHLIB3 sncCurrency SUIPac
💻 PAS
📖 第 1 页 / 共 3 页
字号:
  tq.Close;
  tq.SQL.Clear;
  tq.SQL.Add('select * from Reports order by id');
  tq.Open;
  if tq.RecordCount>0 then
  begin
    SetLength(DM.ReportName,tq.RecordCount);
    SetLength(DM.ReportStoreProcedureName,tq.RecordCount);
    SetLength(DM.ReportFileName,tq.RecordCount);
    SetLength(DM.ReportPageHeight,tq.RecordCount);
    SetLength(DM.ReportPageWidth,tq.RecordCount);
    while not tq.Eof do
    begin
      DM.ReportName[tq.RecNo-1]:=Trim(tq.FieldByName('Name').AsString);
      DM.ReportStoreProcedureName[tq.RecNo-1]:=Trim(tq.FieldByName('StoreProcedureName').AsString);
      DM.ReportFileName[tq.RecNo-1]:=Trim(tq.FieldByName('FileName').AsString);
      cbReportName.Items.Add(DM.ReportName[tq.RecNo-1]);
      DM.ReportPageHeight[tq.RecNo-1]:=tq.FieldByName('PageHeight').AsInteger;
      DM.ReportPageWidth[tq.RecNo-1]:=tq.FieldByName('PageWidth').AsInteger;
      tq.Next;
    end;
    cbReportName.ItemIndex:=0;
    btnQueryReport.Enabled:=true;
  end;
  DM.PDPageWidth:=StrToInt(GetOptionsKeyValue(DM.adoc,'凭证打印纸张宽度'));
  DM.PDPageHeight:=StrToInt(GetOptionsKeyValue(DM.adoc,'凭证打印纸张高度'));
  DM.AccountPageWidth:=StrToInt(GetOptionsKeyValue(DM.adoc,'帐簿打印纸张宽度'));
  DM.AccountPageHeight:=StrToInt(GetOptionsKeyValue(DM.adoc,'帐簿打印纸张高度'));

  tq.Close;
  
  DM.CheckAccountStartedOperation;
end;

procedure TFrmMain.M111Click(Sender: TObject);
begin
  if not DM.CheckRights(1) then Exit;
  if Frm_EditOperator(DM.adoc,'Operator','name','Password','Used',0,16)=mrOK then
    DM.WriteLog('增加、删除操作员。');
end;

procedure TFrmMain.M112Click(Sender: TObject);
begin
  if not DM.CheckRights(1) then Exit;
  if Frm_SetRights(DM.adoc,'Operator','Rights','OperatorRights','Name','Rights','Operator_id','Rights_id','Used')=mrOK then
  begin
    Fun_GetRightsArray(DM.adoc,'Rights','OperatorRights','Operator_id','Rights_id',DM.UserID,DM.UserRIghts); //重新读权限
    DM.WriteLog('设置操作员权限。');
  end;
end;

procedure TFrmMain.M121Click(Sender: TObject);
begin
  if not DM.CheckRights(1) then Exit;
  if Frm_DataBackup(DM.adoc,Fun_GetCurrentPath^+'\DataBackup')=mrOK then DM.WriteLog('数据备份。');
end;

procedure TFrmMain.M122Click(Sender: TObject);
begin
  if not DM.CheckRights(1) then Exit;
  if Frm_MsgBox('系统信息','您确信要恢复数据到以前的某次备份吗?此操作将导致当前数据丢失,请谨慎确定!',MsgBox_YESNO)=mrNO then Exit;
  if Frm_DataRestore(DM.adoc,Fun_GetCurrentPath^+'\DataBackup')=mrOK then
  begin
    DM.WriteLog('数据恢复。');
    Frm_MsgBox('系统信息','数据恢复成功,单击“确定”重新启动本系统...',MsgBox_OK_INFO);
    WinExec(pAnsiChar(Application.ExeName),SW_SHOW);
    DM.UserID:=-1;
    Close;
  end;
end;

procedure TFrmMain.M21Click(Sender: TObject);
var
  fdi:TFrmDeptInfo;
begin
  if not DM.CheckRights(9) then Exit;
  fdi:=TFrmDeptInfo.Create(self);
  if fdi.ShowModal=mrOK then
  begin
    sb.Panels[1].Text:=DM.DeptName;
    sb.Panels[2].Text:='财务主管:'+DM.FinanceManager;
    DM.WriteLog('修改单位信息。');
  end;
  fdi.Destroy;
end;

procedure TFrmMain.M22Click(Sender: TObject);
var
  fes:TFrmEditSubject;
begin
  if not DM.CheckRights(9) then Exit;
  fes:=TFrmEditSubject.Create(self);
  fes.CanEdit:=true;
  fes.CanSelect:=false;
  fes.ShowModal;
  if fes.isEdited then DM.WriteLog('修改会计科目。');
  fes.Destroy;
end;

procedure TFrmMain.M231Click(Sender: TObject);
var
  fsb:TFrmStartBalance;
begin
  if not DM.CheckRights(9) then Exit;
  fsb:=TFrmStartBalance.Create(self);
  if fsb.ShowModal=mrOK then
  begin
    DM.WriteLog('录入期初余额。');
  end;
  fsb.Destroy;
end;

procedure TFrmMain.M232Click(Sender: TObject);
var
  J,D:Currency;
begin
  if not DM.CheckRights(9) then Exit;

  if Frm_MsgBox('系统信息','注意:帐套一经启用后将不能修改期初数。确信要启用帐套吗?',MsgBox_YESNO)=mrNo then Exit;

  tq.Close;
  tq.SQL.Clear;
  tq.SQL.Add('select sum(b.Balance) as J from (select V_Subject.*,a.Balance from V_Subject LEFT OUTER JOIN (select * from Balance where [year]='+IntToStr(DM.AccountYear)+' and [Month]='+IntToStr(DM.AccountMonth)+') as a on V_Subject.id=a.Subject_id) as b where b.J_D_Type=''借''');
  tq.Open;
  J:=tq.FieldByName('J').AsCurrency;
  tq.Close;
  tq.SQL.Clear;
  tq.SQL.Add('select sum(b.Balance) as D from (select V_Subject.*,a.Balance from V_Subject LEFT OUTER JOIN (select * from Balance where [year]='+IntToStr(DM.AccountYear)+' and [Month]='+IntToStr(DM.AccountMonth)+') as a on V_Subject.id=a.Subject_id) as b where b.J_D_Type=''贷''');
  tq.Open;
  D:=tq.FieldByName('D').AsCurrency;
  tq.Close;

  if J<>D then
  begin
    Frm_MsgBox('系统信息','期初余额不平衡,不能启用帐套,请对科目期初余额进行检查。',MsgBox_OK_ERROR);
    Exit;
  end;
  if J=0 then
  begin
    if Frm_MsgBox('系统信息','系统检测到没有录入期初余额,帐套一经启用后将不能修改期初数。确信要启用帐套吗?',MsgBox_YESNO)=mrNo then Exit;
  end;

  tq.Close;
  tq.SQL.Clear;
  tq.SQL.Add('insert into CashBalance select * from Balance where Subject_id in (select id from Subject where IsCash=1)');
  tq.ExecSQL;

  tq.Close;
  tq.SQL.Clear;
  tq.SQL.Add('insert into BankBalance select * from Balance where Subject_id in (select id from Subject where IsBank=1)');
  tq.ExecSQL;
  tq.Close;

  DM.AccountStartState:=True;
  SetOptionsKeyValue(DM.adoc,'帐套启用状态',BoolToStr(DM.AccountStartState));
  SetMenuState;
  sb.Panels[4].Text:='会计期间:'+IntToStr(DM.AccountYear)+'.'+IntToStr(DM.AccountMonth);

  DM.WriteLog('帐套启用。');
  Frm_MsgBox('系统信息','帐套已启用,请注意经常备份您的数据。',MsgBox_OK_INFO);
end;

procedure TFrmMain.M241Click(Sender: TObject);
var
  fpd:TFrmPd;
  Log:string;
begin
  if not DM.CheckRights(2) then Exit;
  if not DM.CheckAccountStartedOperation then Exit;
  fpd:=TFrmPd.Create(self);
  fpd.CanEdit:=true;
  fpd.CanEditSubject:=true;
  fpd.ShowModal;
  Log:='处理凭证,';
  if (not fpd.Edited) and (not fpd.Added) and (not fpd.Deleted) and (not fpd.EditSubjected) then
    Log:=Log+'但未作任何修改。'
  else
  begin
    Log:=Log+'作了:';
    if fpd.Edited then Log:=Log+'[修改]';
    if fpd.Added then Log:=Log+'[新增]';
    if fpd.Deleted then Log:=Log+'[删除]';
    if fpd.EditSubjected then Log:=Log+'[修改会计科目]';
    Log:=Log+'操作。';
  end;
  fpd.Destroy;
  DM.WriteLog(Log);
end;

procedure TFrmMain.M242Click(Sender: TObject);
var
  fqpd:TFrmQueryPD;
begin
  if not DM.CheckRights(6) then Exit;
  if not DM.CheckAccountStartedOperation then Exit;
  fqpd:=TFrmQueryPD.Create(self);
  fqpd.ShowModal;
  fqpd.Destroy;
end;

procedure TFrmMain.M243Click(Sender: TObject);
var
  fcs:TFrmCredenceSpoor;
begin
  if not DM.CheckRights(1) then Exit;
  if not DM.CheckAccountStartedOperation then Exit;
  fcs:=TFrmCredenceSpoor.Create(self);
  fcs.ShowModal;
  if fcs.cleared then DM.WriteLog('清除凭证修改痕迹记录。');
  fcs.Destroy;
end;

procedure TFrmMain.M244Click(Sender: TObject);
var
  fapd:TFrmAuditingPD;
  Log:string;
begin
  if not DM.CheckRights(3) then Exit;
  if not DM.CheckAccountStartedOperation then Exit;
  fapd:=TFrmAuditingPD.Create(self);
  fapd.ShowModal;
  Log:='审核凭证,';
  if (not fapd.Auditinged) and (not fapd.UnAuditinged) and (not fapd.AuditingAlled)  and (not fapd.UnAuditingAlled) then
    Log:=Log+'但未作任何修改。'
  else
  begin
    Log:=Log+'作了:';
    if fapd.Auditinged then Log:=Log+'[审核通过]';
    if fapd.UnAuditinged then Log:=Log+'[取消审核]';
    if fapd.AuditingAlled then Log:=Log+'[成批审核通过]';
    if fapd.UnAuditingAlled then Log:=Log+'[成批取消审核]';
    Log:=Log+'操作。'
  end;
  fapd.Destroy;
  DM.WriteLog(Log);
end;

procedure TFrmMain.M31Click(Sender: TObject);
var
  fqaZBCX:TFrmQueryAccountZBCX;
begin
  if not DM.CheckRights(6) then Exit;
  if not DM.CheckAccountStartedOperation then Exit;
  fqaZBCX:=TFrmQueryAccountZBCX.Create(self);
  fqaZBCX.ShowModal;
  fqaZBCX.Destroy;
end;

procedure TFrmMain.M32Click(Sender: TObject);
var
  fqaKMHZ:TFrmQueryAccountKMHZ;
begin
  if not DM.CheckRights(6) then Exit;
  if not DM.CheckAccountStartedOperation then Exit;
  fqaKMHZ:=TFrmQueryAccountKMHZ.Create(self);
  fqaKMHZ.ShowModal;
  fqaKMHZ.Destroy;
end;

procedure TFrmMain.M33Click(Sender: TObject);
var
  fqaFSEJYE:TFrmQueryAccountFSEJYE;
begin
  if not DM.CheckRights(6) then Exit;
  if not DM.CheckAccountStartedOperation then Exit;
  fqaFSEJYE:=TFrmQueryAccountFSEJYE.Create(self);
  fqaFSEJYE.ShowModal;
  fqaFSEJYE.Destroy;
end;

procedure TFrmMain.M341Click(Sender: TObject);
var
  fqca:TFrmQueryCashAccount;
begin
  if not DM.CheckRights(6) then Exit;
  if not DM.CheckAccountStartedOperation then Exit;
  fqca:=TFrmQueryCashAccount.Create(self);
  fqca.ShowModal;
  fqca.Destroy;
end;

procedure TFrmMain.M342Click(Sender: TObject);
var
  fqba:TFrmQueryBankAccount;
begin
  if not DM.CheckRights(6) then Exit;
  if not DM.CheckAccountStartedOperation then Exit;
  fqba:=TFrmQueryBankAccount.Create(self);
  fqba.ShowModal;
  fqba.Destroy;
end;

procedure TFrmMain.M41Click(Sender: TObject);
begin
  Image18.OnClick(TObject(Image18));
end;

procedure TFrmMain.M123Click(Sender: TObject);
var
  pNewPass:pChar;
begin
  GetMem(pNewPass,100);
  if Frm_ChangePassword(DM.adoc,'Operator','Password',0,16,DM.UserName,DM.UserPassword,DM.SupperPassword,DM.UserID,pNewPass)=mrOK then
  begin
    DM.UserPassword:=pNewPass;
    DM.WriteLog('更改密码。');
  end;
  FreeMem(pNewPass,100);
end;

procedure TFrmMain.M14Click(Sender: TObject);
begin
  Close;
end;

procedure TFrmMain.M13Click(Sender: TObject);
var
  fo:TFrmOptions;
  i:integer;
begin
  if not DM.CheckRights(1) then Exit;
  fo:=TFrmOptions.Create(self);
  for i:=1 to cbReportName.Items.Count do fo.cbReportName.Items.Add(cbReportName.Items[i-1]);
  if fo.ShowModal=mrOK then
    DM.WriteLog('修改选项。');
  fo.Destroy;
end;

procedure TFrmMain.M251Click(Sender: TObject);
var
  fcpd:TFrmCashPD;
  Edited,Added,Deleted:Boolean;
  Log:string;
begin

⌨️ 快捷键说明

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