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

📄 returnunit.pas

📁 学费管理系统,学校使用
💻 PAS
📖 第 1 页 / 共 3 页
字号:
    insurance:=strtofloat(trim(insurance_rt_Edit.Text ));
  except
    MessageBox(application.handle,pchar('实收保险费填写不正确!'),'错误',MB_ICONWARNING+MB_OK);
    insurance_rt_Edit.SetFocus ;
  end;
  try
    live:=strtofloat(trim(live_rt_Edit.Text ));
  except
    MessageBox(application.handle,pchar('生活用品费填写不正确!'),'错误',MB_ICONWARNING+MB_OK);
    live_rt_Edit.SetFocus ;
  end;
  try
    pledge:=strtofloat(trim(pledge_rt_Edit.Text ));
  except
    MessageBox(application.handle,pchar('保证金填写不正确!'),'错误',MB_ICONWARNING+MB_OK);
    pledge_rt_Edit.SetFocus ;
  end;
  sum_rt_Edit.Text :=formatfloat('0.00',tuition+house+book+insurance+live+pledge);

end;

procedure Treturnform.ChargeRangeId_comboboxChange(Sender: TObject);
var
  tuition,house,book,insurance,live,pledge:currency;
begin

  with oper_adoquery do
  begin
    close;
    sql.clear;
    sql.add('select * from income where studentid=:studentid and chargerangeid=:chargerangeid');
    Parameters.ParamByName('studentid').Value := trim(id_Edit.Text );
    Parameters.ParamByName('chargerangeid').Value := trim(ChargeRangeId_combobox.Text );
    open;
    if isempty then
    begin
      MessageBox(application.handle,pchar('没有该年份收费信息!'),'错误',MB_ICONWARNING+MB_OK);
      exit;
    end;
    StudyYear_edit.text:=fieldbyname('StudyYear').asstring;
    while not eof do
    begin
      case fieldbyname('chargeitemid').asinteger of
        1:
        begin
          tuition_be_Edit.text:=formatfloat('0.00',fieldbyname('quantum').asfloat);
          tuition_re_Edit.text:=formatfloat('0.00',fieldbyname('fact').asfloat);
          tuition_rr_Edit.text:=formatfloat('0.00',fieldbyname('returnnum').asfloat);
          derate_edit.Text :=formatfloat('0.00',fieldbyname('derate').asfloat);
          deratename_memo.Text :=trim(fieldbyname('deratename').Asstring);

        end ;
        2:
        begin
          house_be_Edit.text:=formatfloat('0.00',fieldbyname('quantum').asfloat);
          house_re_Edit.text:=formatfloat('0.00',fieldbyname('fact').asfloat);
          house_rr_Edit.text:=formatfloat('0.00',fieldbyname('returnnum').asfloat);

        end;
        3:
        begin
          book_be_Edit.text:=formatfloat('0.00',fieldbyname('quantum').asfloat);
          book_re_Edit.text:=formatfloat('0.00',fieldbyname('fact').asfloat);
          book_rr_Edit.text:=formatfloat('0.00',fieldbyname('returnnum').asfloat);

        end;
        4:
        begin
          insurance_be_Edit.text:=formatfloat('0.00',fieldbyname('quantum').asfloat);
          insurance_re_Edit.text:=formatfloat('0.00',fieldbyname('fact').asfloat);
          insurance_rr_Edit.text:=formatfloat('0.00',fieldbyname('returnnum').asfloat);

        end;
        5:
        begin
          live_be_Edit.text:=formatfloat('0.00',fieldbyname('quantum').asfloat);
          live_re_Edit.text:=formatfloat('0.00',fieldbyname('fact').asfloat);
          live_rr_Edit.text:=formatfloat('0.00',fieldbyname('returnnum').asfloat);

        end;
        6:
        begin
          pledge_be_Edit.text:=formatfloat('0.00',fieldbyname('quantum').asfloat);
          pledge_re_Edit.text:=formatfloat('0.00',fieldbyname('fact').asfloat);
          pledge_rr_Edit.text:=formatfloat('0.00',fieldbyname('returnnum').asfloat);
        end;

      end;
      next;
    end;
  end;




  tuition:=strtofloat(trim(tuition_be_Edit.Text ));
  house:=strtofloat(trim(house_be_Edit.Text ));
  book:=strtofloat(trim(book_be_Edit.Text ));
  insurance:=strtofloat(trim(insurance_be_Edit.Text ));
  live:=strtofloat(trim(live_be_Edit.Text ));
  pledge:=strtofloat(trim(pledge_be_Edit.Text ));
  sum_be_Edit.Text :=formatfloat('0.00',tuition+house+book+insurance+live+pledge);

  tuition:=strtofloat(trim(tuition_re_Edit.Text ));
  house:=strtofloat(trim(house_re_Edit.Text ));
  book:=strtofloat(trim(book_re_Edit.Text ));
  insurance:=strtofloat(trim(insurance_re_Edit.Text ));
  live:=strtofloat(trim(live_re_Edit.Text ));
  pledge:=strtofloat(trim(pledge_re_Edit.Text ));
  sum_re_Edit.Text :=formatfloat('0.00',tuition+house+book+insurance+live+pledge);

  tuition:=strtofloat(trim(tuition_rr_Edit.Text ));
  house:=strtofloat(trim(house_rr_Edit.Text ));
  book:=strtofloat(trim(book_rr_Edit.Text ));
  insurance:=strtofloat(trim(insurance_rr_Edit.Text ));
  live:=strtofloat(trim(live_rr_Edit.Text ));
  pledge:=strtofloat(trim(pledge_rr_Edit.Text ));
  sum_rr_Edit.Text :=formatfloat('0.00',tuition+house+book+insurance+live+pledge);

  groupbox1.enabled:=true;
end;

procedure Treturnform.cancel_BitBtnClick(Sender: TObject);
begin
  buttonUse(true);
  ClearContent ;
  StudentName_Edit.Enabled :=true;
  search_BitBtn.Enabled :=true;
  cancel_bitbtn.Enabled :=false;
  ChargeRangeId_combobox.Enabled :=false;
  groupbox1.enabled:=false;
  StudentName_Edit.SetFocus ;
end;

procedure Treturnform.new_BitBtnClick(Sender: TObject);
begin
  if not print then
    if messagebox(handle,pchar('退费票据没有打印,是否打印'),'请选择',MB_ICONQUESTION	+MB_YESNO)=6 then exit;
  buttonUse(true);
  ClearContent ;
  StudentName_Edit.Enabled :=true;
  search_BitBtn.Enabled :=true;
  cancel_bitbtn.Enabled :=false;
  ChargeRangeId_combobox.Enabled :=false;
  groupbox1.enabled:=false;
  StudentName_Edit.SetFocus ;
end;

procedure Treturnform.save_BitBtnClick(Sender: TObject);
var
  TmpID,tmpstr:String;
  tmpmoney:currency;
  i:integer;
begin
  if trim(StudentName_Edit.Text )='' then
  begin
    MessageBox(application.handle,pchar('姓名没有填写!'),'错误',MB_ICONWARNING+MB_OK);
    StudentName_Edit.SetFocus ;
    exit;
  end;
  if trim(ChargeRangeId_combobox.Text )='' then
  begin
    MessageBox(application.handle,pchar('收费年份没有选择!'),'错误',MB_ICONWARNING+MB_OK);
    ChargeRangeId_combobox.SetFocus ;
    exit;
  end;
  if trim(tuition_rt_Edit.Text )<>'0' then
    if trim(tuition_code_Edit.Text )='' then
    begin
      MessageBox(application.handle,pchar('学费的退费情况没有填写!'),'错误',MB_ICONWARNING+MB_OK);
      tuition_code_Edit.SetFocus ;
      exit;
    end;


  if trim(house_rt_Edit.Text )<>'0' then
    if trim(house_code_Edit.Text )='' then
    begin
      MessageBox(application.handle,pchar('住宿费的退费情况没有填写!'),'错误',MB_ICONWARNING+MB_OK);
      house_code_Edit.SetFocus ;
      exit;
    end;
  if trim(book_rt_Edit.Text )<>'0' then
    if trim(book_code_Edit.Text )='' then
    begin
      MessageBox(application.handle,pchar('书费的退费情况没有填写!'),'错误',MB_ICONWARNING+MB_OK);
      book_code_Edit.SetFocus ;
      exit;
    end;

  if trim(insurance_rt_Edit.Text )<>'0' then
    if trim(insurance_code_Edit.Text )='' then
    begin
      MessageBox(application.handle,pchar('保险费的退费情况没有填写!'),'错误',MB_ICONWARNING+MB_OK);
      insurance_code_Edit.SetFocus ;
      exit;
    end;

  if trim(live_rt_Edit.Text )<>'0' then
    if trim(live_code_Edit.Text )='' then
    begin
      MessageBox(application.handle,pchar('生活用品的退费情况没有填写!'),'错误',MB_ICONWARNING+MB_OK);
      live_code_Edit.SetFocus ;
      exit;
    end;
  if trim(pledge_rt_Edit.Text )<>'0' then
    if trim(pledge_code_Edit.Text )='' then
    begin
      MessageBox(application.handle,pchar('保证金的退费情况没有填写!'),'错误',MB_ICONWARNING+MB_OK);
      pledge_code_Edit.SetFocus ;
      exit;
    end;
  if trim(returncode_Edit.Text )='' then
  begin
    MessageBox(application.handle,pchar('退费单号没有填写!'),'错误',MB_ICONWARNING+MB_OK);
    returncode_edit.SetFocus ;
    exit;
  end;
  dm.ADOConnection.BeginTrans ;
  try
    with oper_adoquery do
    begin
      tmpid:=trim(id_edit.text);
      for i :=1  to 6 do
      begin
        close;
        sql.clear;
        sql.Add('select * from income where');
        sql.Add(' StudentID =:StudentID and ChargeRangeId =:ChargeRangeId');
        sql.Add(' and ChargeItemId=:ChargeItemId ');
        Parameters.ParamByName('StudentID').Value :=tmpid;
        Parameters.ParamByName('ChargeRangeId').Value :=ChargeRangeId_combobox.Text ;
        Parameters.ParamByName('ChargeItemId').Value := i;
        open;
        tmpstr:=trim(fieldbyname('returnname').AsString) ;
        tmpmoney:=fieldbyname('returnnum').AsFloat ;

        //收支总表
        close;
        sql.Clear;
        sql.Add('update income set returnnum=:returnnum, returnname =:returnname where');
        sql.Add(' StudentID =:StudentID and ChargeRangeId =:ChargeRangeId');
        sql.Add('  and ChargeItemId=:ChargeItemId ');
        Parameters.ParamByName('StudentID').Value :=tmpid;
        Parameters.ParamByName('ChargeRangeId').Value :=ChargeRangeId_combobox.Text ;
        Parameters.ParamByName('ChargeItemId').Value := i;
        case i of
          1 :
          begin
            Parameters.ParamByName('returnnum').Value := tmpmoney+strtofloat(trim(tuition_rt_Edit.Text) );
            Parameters.ParamByName('returnname').Value :=tmpstr+#13#10+trim(tuition_code_Edit.Text) ;
          end;
          2:
          begin
            Parameters.ParamByName('returnnum').Value := tmpmoney+strtofloat(trim(house_rt_Edit.Text) );
            Parameters.ParamByName('returnname').Value :=tmpstr+#13#10+trim(house_code_Edit.Text) ;
          end;
          3:
          begin
            Parameters.ParamByName('returnnum').Value := tmpmoney+strtofloat(trim(book_rt_Edit.Text) );
            Parameters.ParamByName('returnname').Value :=tmpstr+#13#10+trim(book_code_Edit.Text) ;
          end;
          4:
          begin
            Parameters.ParamByName('returnnum').Value := tmpmoney+strtofloat(trim(insurance_rt_Edit.Text) );
            Parameters.ParamByName('returnname').Value :=tmpstr+#13#10+trim(insurance_code_Edit.Text) ;
          end;
          5:
          begin
            Parameters.ParamByName('returnnum').Value := tmpmoney+strtofloat(trim(live_rt_Edit.Text) );
            Parameters.ParamByName('returnname').Value :=tmpstr+#13#10+trim(live_code_Edit.Text) ;
          end;
          6:
          begin
            Parameters.ParamByName('returnnum').Value := tmpmoney+strtofloat(trim(pledge_rt_Edit.Text) );
            Parameters.ParamByName('returnname').Value :=tmpstr+#13#10+trim(pledge_code_Edit.Text) ;
          end;
        end;
        ExecSQL ;
     end;



      //退费明细
      close;
      sql.Clear;
      sql.Add('insert into returndetail (StudentID,ChargeRangeId,StudyYear,ChargeItemId, ');
      sql.Add('Quantum,receive,returnnum,returnname,returncode,RegDate,Operator ) values ( ');
      sql.Add(':StudentID,:ChargeRangeId,:StudyYear,:ChargeItemId,');
      sql.Add(':Quantum,:receive,:returnnum,:returnname,:returncode,:RegDate,:Operator )');
      if Not Prepared then Prepared:=true;

      //学费
      close;
      Parameters.ParamByName('StudentID').Value :=tmpid ;
      Parameters.ParamByName('ChargeRangeId').Value :=ChargeRangeId_combobox.Text ;
      Parameters.ParamByName('StudyYear').Value :=StudyYear_edit.Text ;
      Parameters.ParamByName('ChargeItemId').Value := 1;
      Parameters.ParamByName('Quantum').Value :=0;//trim(tuition_be_Edit.Text );
      Parameters.ParamByName('receive').Value :=0;//trim(tuition_re_Edit.Text );
      Parameters.ParamByName('returnnum').Value :=trim(tuition_rt_Edit.Text );
      Parameters.ParamByName('returnname').Value :=trim(tuition_code_Edit.Text );
      Parameters.ParamByName('returncode').Value :=trim(returncode_edit.Text );
      Parameters.ParamByName('RegDate').Value :=now;
      Parameters.ParamByName('Operator').Value :=Oper.code ;
      ExecSQL ;

      //住宿
      close;

⌨️ 快捷键说明

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