📄 billcodeeditunit.pas
字号:
close;
sql.clear;
sql.add('select * from firstreg 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('recetype').AsInteger of
0: ReceType_edit.Text :='现金';
1: ReceType_edit.Text :='邮局汇款';
2: ReceType_edit.Text :='银行';
end;
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_code_Edit.text:=fieldbyname('billcode').asstring;
end ;
2:
begin
house_be_Edit.text:=formatfloat('0.00',fieldbyname('quantum').asfloat);
house_re_Edit.text:=formatfloat('0.00',fieldbyname('fact').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_code_Edit.text:=fieldbyname('billcode').asstring;
end;
4:
begin
insurance_be_Edit.text:=formatfloat('0.00',fieldbyname('quantum').asfloat);
insurance_re_Edit.text:=formatfloat('0.00',fieldbyname('fact').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_code_Edit.text:=fieldbyname('billcode').asstring;
end;
6:
begin
pledge_be_Edit.text:=formatfloat('0.00',fieldbyname('quantum').asfloat);
pledge_re_Edit.text:=formatfloat('0.00',fieldbyname('fact').asfloat);
pledge_code_Edit.text:=fieldbyname('billcode').asstring;
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);
buttonUse(false);
tuition_s:=trim(tuition_code_Edit.Text );
book_s:=trim(book_code_Edit.Text);
live_s:=trim(live_code_Edit.Text);
pledge_s:=trim(pledge_code_Edit.Text);
tuition_code_Edit.SetFocus ;
end;
procedure Tbillcodeeditform.tuition_be_EditEnter(Sender: TObject);
begin
if (sender as tedit).Text ='0' then (sender as tedit).Text:='';
end;
procedure Tbillcodeeditform.sum_be_EditEnter(Sender: TObject);
var
tuition,house,book,insurance,live,pledge:currency;
begin
try
tuition:=strtofloat(trim(tuition_be_Edit.Text ));
except
MessageBox(application.handle,pchar('应收学费填写不正确!'),'错误',MB_ICONWARNING+MB_OK);
tuition_be_Edit.SetFocus ;
end;
try
house:=strtofloat(trim(house_be_Edit.Text ));
except
MessageBox(application.handle,pchar('应收住宿费填写不正确!'),'错误',MB_ICONWARNING+MB_OK);
house_be_Edit.SetFocus ;
end;
try
book:=strtofloat(trim(book_be_Edit.Text ));
except
MessageBox(application.handle,pchar('应收书费填写不正确!'),'错误',MB_ICONWARNING+MB_OK);
book_be_Edit.SetFocus ;
end;
try
insurance:=strtofloat(trim(insurance_be_Edit.Text ));
except
MessageBox(application.handle,pchar('应收保险费填写不正确!'),'错误',MB_ICONWARNING+MB_OK);
insurance_be_Edit.SetFocus ;
end;
try
live:=strtofloat(trim(live_be_Edit.Text ));
except
MessageBox(application.handle,pchar('应收生活用品费填写不正确!'),'错误',MB_ICONWARNING+MB_OK);
live_be_Edit.SetFocus ;
end;
try
pledge:=strtofloat(trim(pledge_be_Edit.Text ));
except
MessageBox(application.handle,pchar('应收保证金填写不正确!'),'错误',MB_ICONWARNING+MB_OK);
pledge_be_Edit.SetFocus ;
end;
sum_be_Edit.Text :=formatfloat('0.00',tuition+house+book+insurance+live+pledge);
end;
procedure Tbillcodeeditform.close_BitBtnClick(Sender: TObject);
begin
self.Close;
end;
procedure Tbillcodeeditform.editreg_bitbtnClick(Sender: TObject);
begin
clearcontent(false);
ButtonUse(true);
cancel_BitBtn.Enabled:=true;
StudentName_Edit.Enabled :=false;
search_BitBtn.Enabled :=false;
if firstreg_radiobutton.Checked then
begin
label53.Visible :=true;
ChargeRangeId_combobox.Visible :=true;
label7.Visible :=false;
regdate_combobox.Visible :=false;
regdate_combobox.Enabled :=false;
ChargeRangeId_combobox.Enabled :=true;
ChargeRangeId_combobox.ItemIndex:=-1;
ChargeRangeId_combobox.Items.Clear;
with oper_adoquery do
begin
close;
sql.Clear;
sql.Add('select distinct(chargerangeid) as chargerange from firstreg where studentid=:studentid');
Parameters.ParamByName('studentid').Value := trim(id_Edit.Text );
open;
while not eof do
begin
ChargeRangeId_combobox.Items.Add(fieldbyname('chargerange').AsString );
next;
end;
end;
end
else if editreg_bitbtn.Checked then
begin
label7.Visible :=true;
regdate_combobox.Visible :=true;
label53.Visible :=false;
ChargeRangeId_combobox.Visible :=false;
regdate_combobox.Enabled :=true;
ChargeRangeId_combobox.Enabled :=false;
regdate_combobox.ItemIndex:=-1;
regdate_combobox.Items.Clear;
with oper_adoquery do
begin
close;
sql.Clear;
sql.Add('select distinct(regdate) from editreg where studentid=:studentid order by regdate');
Parameters.ParamByName('studentid').Value := trim(id_Edit.Text );
open;
while not eof do
begin
regdate_combobox.Items.Add(fieldbyname('regdate').AsString );
next;
end;
end;
end;
end;
procedure Tbillcodeeditform.regdate_comboboxChange(Sender: TObject);
var
tuition,house,book,insurance,live,pledge:currency;
begin
clearcontent(false);
with oper_adoquery do
begin
close;
sql.clear;
sql.add('select * from EditReg where studentid=:studentid and RegDate=:RegDate');
Parameters.ParamByName('studentid').Value := trim(id_Edit.Text );
Parameters.ParamByName('RegDate').Value := regdate_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('recetype').AsInteger of
0: ReceType_edit.Text :='现金';
1: ReceType_edit.Text :='邮局汇款';
2: ReceType_edit.Text :='银行';
end;
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('Receive').asfloat);
tuition_code_Edit.text:=fieldbyname('billcode').asstring;
end ;
2:
begin
house_be_Edit.text:=formatfloat('0.00',fieldbyname('quantum').asfloat);
house_re_Edit.text:=formatfloat('0.00',fieldbyname('Receive').asfloat);
end;
3:
begin
book_be_Edit.text:=formatfloat('0.00',fieldbyname('quantum').asfloat);
book_re_Edit.text:=formatfloat('0.00',fieldbyname('Receive').asfloat);
book_code_Edit.text:=fieldbyname('billcode').asstring;
end;
4:
begin
insurance_be_Edit.text:=formatfloat('0.00',fieldbyname('quantum').asfloat);
insurance_re_Edit.text:=formatfloat('0.00',fieldbyname('Receive').asfloat);
end;
5:
begin
live_be_Edit.text:=formatfloat('0.00',fieldbyname('quantum').asfloat);
live_re_Edit.text:=formatfloat('0.00',fieldbyname('Receive').asfloat);
live_code_Edit.text:=fieldbyname('billcode').asstring;
end;
6:
begin
pledge_be_Edit.text:=formatfloat('0.00',fieldbyname('quantum').asfloat);
pledge_re_Edit.text:=formatfloat('0.00',fieldbyname('Receive').asfloat);
pledge_code_Edit.text:=fieldbyname('billcode').asstring;
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);
buttonUse(false);
GroupBox5.Enabled :=true;
tuition_s:=trim(tuition_code_Edit.Text );
book_s:=trim(book_code_Edit.Text);
live_s:=trim(live_code_Edit.Text);
pledge_s:=trim(pledge_code_Edit.Text);
tuition_code_Edit.SetFocus ;
end;
procedure Tbillcodeeditform.save_bitbtnClick(Sender: TObject);
var
tmpstr,tmpstr1:string;
begin
if firstreg_radiobutton.Checked then
begin
tmpstr:='FirstReg';
tmpstr1:='and ChargeRangeId='+ChargeRangeId_combobox.Text ;
end
else if editreg_bitbtn.Checked then
begin
tmpstr:='EditReg';
tmpstr1:='and RegDate='''+regdate_combobox.Text +'''';
end;
with oper_adoquery do
begin
if tuition_s<>trim(tuition_code_Edit.Text ) then
begin
close;
sql.Clear;
sql.Add('update '+tmpstr+' set BillCode=:BillCode where StudentID=:StudentID and BillCode=:oBillCode '+tmpstr1);
Parameters.ParamByName('BillCode').Value :=trim(tuition_code_Edit.Text );
Parameters.ParamByName('StudentID').Value :=trim(id_Edit.Text );
Parameters.ParamByName('oBillCode').Value :=tuition_s;
ExecSQL ;
end;
if book_s<>trim(book_code_Edit.Text) then
begin
close;
sql.Clear;
sql.Add('update '+tmpstr+' set BillCode=:BillCode where StudentID=:StudentID and BillCode=:oBillCode '+tmpstr1);
Parameters.ParamByName('BillCode').Value :=trim(book_code_Edit.Text);
Parameters.ParamByName('StudentID').Value :=trim(id_Edit.Text );
Parameters.ParamByName('oBillCode').Value :=book_s;
ExecSQL ;
end;
if live_s<>trim(live_code_Edit.Text) then
begin
close;
sql.Clear;
sql.Add('update '+tmpstr+' set BillCode=:BillCode where StudentID=:StudentID and BillCode=:oBillCode '+tmpstr1);
Parameters.ParamByName('BillCode').Value :=trim(live_code_Edit.Text);
Parameters.ParamByName('StudentID').Value :=trim(id_Edit.Text );
Parameters.ParamByName('oBillCode').Value :=live_s;
ExecSQL ;
end;
if pledge_s<>trim(pledge_code_Edit.Text) then
begin
close;
sql.Clear;
sql.Add('update '+tmpstr+' set BillCode=:BillCode where StudentID=:StudentID and BillCode=:oBillCode '+tmpstr1);
Parameters.ParamByName('BillCode').Value :=trim(pledge_code_Edit.Text);
Parameters.ParamByName('StudentID').Value :=trim(id_Edit.Text );
Parameters.ParamByName('oBillCode').Value :=pledge_s;
ExecSQL ;
end;
end;
messagebox(handle,pchar('票据编号修改成功!'),pchar('成功'), MB_ICONINFORMATION+mb_ok);
firstreg_radiobutton.Checked :=true;
buttonUse(true);
ClearContent ;
StudentName_Edit.Enabled :=true;
search_BitBtn.Enabled :=true;
cancel_bitbtn.Enabled :=false;
ChargeRangeId_combobox.Enabled :=false;
firstreg_radiobutton.Enabled :=false;
editreg_bitbtn.Enabled :=false;
regdate_combobox.Enabled :=false;
Label7.Visible :=false;
regdate_combobox.Visible :=false;
StudentName_Edit.SetFocus ;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -