📄 pawnmodify.~pa
字号:
Add('四个月');
Add('五个月');
Add('六个月');
Add('七个月');
Add('八个月');
Add('九个月');
Add('十个月');
Add('十一个月');
Add('十二个月');
end;
cmbPawnLimit.ItemIndex :=1;
end;
//初始化证件名称组合框
procedure TfrmPawnModify.IniDBCombox ;
begin
with cmbCerName.Items do
begin
with dmPawnFrm do
begin
tblCertificate.First ;
while not tblCertificate.Eof do
begin
Add(tblCertificate.fieldByName('Name').asstring);
tblCertificate.Next ;
end;
end;
end;
cmbCerName.ItemIndex :=0;
end;
//初始化画面中文本框的最大输入值
procedure TfrmPawnModify.IniControlBox ;
begin
txtPawnCode.MaxLength :=15;
txtName.MaxLength :=20;
txtAddress.MaxLength :=60;
txtCerCode.MaxLength :=20;
txtPhone.MaxLength :=20;
txtZip.MaxLength :=6;
txtLinkman.MaxLength :=20;
//txtPawnBeginYear.MaxLength :=4;
//txtPawnBeginMonth.MaxLength :=2;
//txtPawnBeginDay.MaxLength :=2;
//txtPawnEndYear.MaxLength :=4;
//txtPawnEndMonth.MaxLength :=2;
//txtPawnEndDay.MaxLength :=2 ;
end;
//清空画面
procedure TfrmPawnModify.ClearForm ;
begin
self.staModify.Caption:='';
//将当票编号设为允许修改
if txTpawnCode.ReadOnly=True then
begin
txtpawnCode.ReadOnly:=False;
end;
if txtpawnCode.Color=clSilver then
begin
txtpawnCode.Color:=clWindow;
end;
txtpawncode.text:='';
txtName.Text :='';
cmbCerName.Text :='';
txtCerCode.Text :='';
txtAddress.Text :='';
txtPhone.Text :='';
txtZip.Text :='';
txtLinkman.Text :='';
txtmonthrate.text:='';
txtfeerate.text:='';
txttotalpawnmoney.text:='';
txtservicefee.text:='';
txtrealpaymoney.text:='';
txtRate.Text:='';
txtpawnbeginyear.text:='';
txtpawnbeginmonth.text:='';
txtpawnbeginday.text:='';
txtpawnendyear.text:='';
txtpawnendmonth.text:='';
txtpawnendday.text:='';
dmPawnFrm.tblModifyDetail.Close;
txtpawncode.setfocus;
end;
//初始化网格中物品类别栏
procedure TfrmPawnModify.IniCategoryInDg ;
begin
with cmbPawnCategory.Items do
begin
with dmPawnFrm do
begin
tblCategory.First ;
while not tblCategory.Eof do
begin
Add(tblCategory.FieldByName('Name').asstring);
tblCategory.Next ;
end;
end;
end;
cmbPawnCategory.ItemIndex:=0;
end;
procedure TfrmPawnModify.cmdQueryClick(Sender: TObject);
var
frmPawnQuery:TfrmPawnQuery;
key:word;
Shift:TShiftState;
begin
frmPawnQuery:=TfrmPawnQuery.Create (nil);
frmPawnQuery.cmdDelete.Visible:=False;
frmPawnQuery.cmdLost.Visible :=False;
frmPawnQuery.cmdFind.Visible :=False;
ModifyMark:=True;
frmPawnQuery.ShowModal;
key:=VK_RETURN;
self.txtPawnCode.Text:=PawnQuery.ModifyCode;
frmPawnQuery.Free;
txtPawnCodeKeyDown(Sender,key,Shift);
//frmPawnQuery.Free;
end;
procedure TfrmPawnModify.cmdExitClick(Sender: TObject);
begin
with dmPawn.dmPawnFrm do
begin
tblHead.FreeBookmark (HeadBookMark);
tblModifyDetail.FreeBookmark(DetailBookMark);
DBookMarkExist:=False;
tblHead.close;
tblDetail.close;
tblModifyDetail.Close;
tblModifyDetail.EmptyTable;
if ModifyTableOpenMark=True then
begin
ModifyTableOpenMark:=False;
end;
tblCertificate.close;
tblCategory.close;
end;
close;
end;
procedure TfrmPawnModify.txtPawnCodeKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
QuerySql:string;
BeginYear,EndYear,BeginMonth,EndMonth:word;
BeginDay,EndDay:word;
DaysLimit:integer;
Limit:integer; //计算典当期限
DayWuCha:integer; //选择的典当期限与输入的典当日期的时间间隔的误差
DayObject:TDayClass; //自定义的类 in GlobalVar
//MonthR,TotalM:Double;
begin
if key=VK_RETURN then
begin
staModify.Caption:='';
if txtPawnCode.Text='' then
begin
messagedlg(Msg.MsgPawnCodeInput,mtWarning,[mbYes],0);
txtPawnCode.SetFocus ;
end
else
begin
with dmPawnFrm do
begin
tblHead.Open;
tblHead.IndexFieldNames:='PawnTicketCode';
tblHead.SetKey ;
tblHead.FieldByName('PawnTicketCode').AsString:=trim(txtPawnCode.text);
if tblHead.GotoKey then
begin
HeadBookMark:=tblHead.GetBookmark ;
if (tblHeadStatus.Value ='未赎') or
(tblHeadStatus.Value='解挂') or
(tblHeadStatus.Value='半处') or
(tblHeadStatus.Value='绝当')then
begin
QueryPawnCode:=trim(txtPawnCode.text);
DaysLimit:=Round(Now-tblHeadPawnEndDate.Value);
if DaysLimit<0 then
staModify.Caption :=Msg.StatusBuyOnline;
if (DaysLimit>=1) and (DaysLimit<=10) or (DaysLimit>10) then
staModify.Caption:=Msg.StatusBuyTimeOut;
//if DaysLimit>10 then
if tblHeadStatus.Value='绝当' then
staModify.Caption:=Msg.StatusBuyDeadPawn;
//将客户信息从头表中取出放入当户栏中
txtName.Text :=tblHeadPawnerName.Value ;
cmbCerName.Text :=tblHeadCertificateName.Value ;
txtCerCode.Text :=tblHeadCertificateCode.Value;
txtPhone.Text :=tblHeadTelephoneCode.Value ;
txtZip.Text:=tblHeadPostCode.Value ;
txtLinkman.Text :=tblHeadLinkman.Value ;
txtAddress.Text :=tblHeadPawnerAddress.Value ;
txtMonthRate.Text :=format('%8.1f',[tblHeadMonthRate.Value]);
txtFeeRate.Text :=tblHeadFeeRate.asstring;//format('%8.1f',[tblHeadFeeRate.Value]);
txtTotalPawnMoney.Text :=format('%8.1f',[tblHeadTotalPawnMoney.Value]);
txtServiceFee.Text :=format('%8.1f',[tblHeadSynthesizeFee.Value]);
txtRealPayMoney.Text :=format('%8.1f',[tblHeadRealPayMoney.Value]);
DecodeDate(tblHeadPawnBeginDate.Value ,BeginYear,BeginMonth,BeginDay);
DecodeDate(tblHeadPawnEndDate.Value ,EndYear,EndMonth,EndDay);
txtPawnBeginYear.Value:=BeginYear;
txtPawnBeginMonth.Value:=BeginMonth;
txtPawnBeginDay.Value:=BeginDay;
txtPawnEndYear.Value:=EndYear;
txtPawnEndMonth.Value:=EndMonth;
txtPawnEndDay.Value:=EndDay;
//将典当的起始终到日期换算为相差几个月,反应到选择典当期限上
DayObject:=TDayClass.Create;
Limit:=EndYear-BeginYear;
Limit:=(Limit*12)+(EndMonth-BeginMonth);
Limit:=Limit*DayObject.GetDays(BeginMonth,BeginDay)+1+(EndDay-BeginDay);
DayWuCha:=Limit div DayObject.GetDays(BeginMonth,BeginDay);
//释放对象
DayObject.Free;
cmbPawnLimit.ItemIndex:=DayWuCha;
TimeLimit:=DayWuCha;
{//计算典当日期
txtPawnEndDayExit(Sender);
//计算利息
if txtMonthRate.Text='' then
MonthR:=0
else
MonthR:=strtofloat(txtMonthRate.text);
if txtTotalPawnMoney.Text='' then
TotalM:=0
else
TotalM:=strtofloat(txtTotalPawnMoney.Text);
txtRate.Text:=Format('%8.1f',[TimeLimit*TotalM*
MonthR/100]);}
//取出利息
txtRate.Text:=format('%8.1f',[tblHeadMonthRateFee.asfloat]);
//再从细表查询此当票编号中取出当物信息放入当物栏中
QuerySql:='select PawnTicketCode,PawnLineNum,PawnName,PawnCategory,PawnSpec,';
QuerySql:=QuerySql+'PawnNumber,AppriseValue,DiscountRate,PawnMoney from PawnDetail_Tbl ';
QuerySql:=QuerySql+ 'where True and PawnTicketCode='''+trim(txtPawnCode.text)+'''';
QuerySql:=QuerySql+ ' and Status='''' ';
dqDetail.close;
dqDetail.SQL.clear;
dqDetail.SQL.add(QuerySql);
dqDetail.Open;
if not dqDetail.IsEmpty then
begin //将结果放入临时数据表DetailTemp中
dqDetail.First;
tblModifyDetail.Close;
tblModifyDetail.EmptyTable;
tblModifyDetail.Open;
while not dqDetail.Eof do
begin
tblModifyDetail.Append;
tblModifyDetailPawnTicketCode.Value:=dqDetail.fieldByName('PawnTicketCode').Value;
tblModifyDetailPawnLineNum.Value:=dqDetail.FieldByName('PawnLineNum').Value;
tblModifyDetailPawnName.Value:=dqDetail.FieldByName('PawnName').Value;
tblModifyDetailPawnCategory.Value:=dqDetail.FieldByName('PawnCategory').Value;
tblModifyDetailPawnSpec.Value:=dqDetail.FieldByName('PawnSpec').Value;
tblModifyDetailPawnNumber.Value:=dqDetail.FieldByName('PawnNumber').Value;
tblModifyDetailAppriseValue.Value:=dqDetail.FieldByName('AppriseValue').Value;
tblModifyDetailDiscountRate.Value:=dqDetail.FieldByName('DiscountRate').Value;
tblModifyDetailPawnMoney.Value:=dqDetail.FieldByName('PawnMoney').Value;
tblModifyDetail.Post;
dqDetail.Next;
end;
tblModifyDetail.First;
//将当票编号设为不允许修改
if txtpawnCode.ReadOnly=False then
begin
txtpawnCode.ReadOnly:=True;
end;
if txtpawnCode.Color=clWindow then
begin
txtpawnCode.Color:=clSilver;
end;
end
else
begin
exit;
end;
{tblModifyDetail.Filtered:=True;
//tblModifyDetail.Filter:='';
QuerySql:='PawnTicketCode='''+trim(txtPawnCode.text)+'''';
QuerySql:=QuerySql+' and Status=''''';
tblModifyDetail.Filter:=QuerySql;
tblModifyDetail.Open;}
//第一条记录会出现在当物修改栏中
DetailBookMark:=tblModifyDetail.GetBookmark;
//动态数组的长度
MaxIndex:=tblModifyDetail.RecordCount;
//定义动态数组的长度,0..MaxIndex-1
SetLength(LineNumberArray,MaxIndex);
{//记录下第一条记录的行号,供比较}
ArrayIndex:=0;
//LineNumberArray[ArrayIndex]:=tblModifyDetailPawnLineNum.AsInteger;
if DBookMarkExist=False then
begin
DBookMarkExist:=True;
end;
if ModifyTableOpenMark=False then
begin
ModifyTableOpenMark:=True;
end;
txtName.SetFocus;
end
else
begin
ClearForm;
//messagedlg(Msg.MsgModifyInfo,mtWarning,[mbYes],0);
if tblHeadStatus.Value='赎回'then
messagedlg(Msg.MsgBuyBuyed,mtWarning,[mbYes],0);
if tblHeadStatus.Value='挂失'then
messagedlg(Msg.MsgBuyLost,mtWarning,[mbYes],0);
if tblHeadStatus.Value='处理'then
messagedlg(Msg.MsgBuyDeadOutStock,mtWarning,[mbYes],0);
end;
end
else
begin
ClearForm;
messagedlg(Msg.MsgPawnNoExist,mtWarning,[mbYes],0);
txtPawnCode.SetFocus ;
end;
end;
end;
end;
end;
procedure TfrmPawnModify.txtNameKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=VK_RETURN then
begin
if txtName.Text='' then
begin
messagedlg(Msg.MsgPawnerName,mtWarning,[mbYes],0);
txtName.SetFocus;
exit;
end;
cmbCerName.SetFocus ;
end;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -