📄 pur510_02.pas.svn-base
字号:
Abort;
end;
end;
if trim(cbFrom.Text)='' then
begin
ShowMsg('UMS10000529'); //来源类型不能为空
cbFrom.SetFocus;
Abort;
end;
if trim(edtCust.Text)='' then
begin
ShowMsg('UMS10000180'); //客户编号不能为空
PageControl2.ActivePageIndex:=0;
edtCust.SetFocus;
Abort;
end;
if not qryOrd150.Locate('O150_002',edtCust.Text,[]) then
begin
ShowMsg('UMS10000264'); //输入的客户编号无效
PageControl2.ActivePageIndex:=0;
edtCust.SetFocus;
Abort;
end;
ACustNo:=qryOrd150.FieldByName('O150_001').AsInteger;
if trim(edtPlace.Text)='' then
begin
ShowMsg('UMS10000190'); //交货地点不能为空
PageControl2.ActivePageIndex:=1;
edtPlace.SetFocus;
Abort;
end;
if not qryOrd152.Locate('O152_002',edtPlace.Text,[]) then
begin
ShowMsg('UMS10000420'); //输入的交货地点无效
PageControl2.ActivePageIndex:=1;
edtPlace.SetFocus;
Abort;
end;
if adsPur510B.State in [dsInsert,dsEdit] then adsPur510B.Post;
if adsPur510B.IsEmpty then
begin
ShowMsg('UMS10000421'); //产品信息资料不能为空
PageControl1.ActivePageIndex:=0;
wwDBGrid1.SetFocus;
Abort;
end;
if TabSheet1.TabVisible then
begin
if trim(edtCust1.Text)='' then
begin
ShowMsg('UMS10000180'); //客户编号不能为空
PageControl2.ActivePageIndex:=4;
edtCust1.SetFocus;
Abort;
end;
if not qryOrd1501.Locate('O150_002',edtCust1.Text,[]) then
begin
ShowMsg('UMS10000264'); //输入的客户编号无效
PageControl2.ActivePageIndex:=4;
edtCust1.SetFocus;
Abort;
end;
end;
if TabSheet2.TabVisible then
begin
if (trim(edtItemID.Text)<>'') and (not qryOrd153.Locate('I150_002',edtItemID.Text,[])) then
begin
ShowMsg('UMS10000267'); //输入的产品编号无效
PageControl2.ActivePageIndex:=5;
edtItemID.SetFocus;
Abort;
end;
AItemNo:=qryOrd153.FieldByName('I150_001').AsInteger;
if (trim(edtMacNo.Text)<>'') and (not qryOrd153.Locate('I150_001;O153_003',VarArrayOf([AItemNo,edtMacNo.Text]),[])) then
begin
ShowMsg('UMS10000268'); //输入的机身编号无效
PageControl2.ActivePageIndex:=5;
edtMacNo.SetFocus;
Abort;
end;
end;
if adsPur510.State in [dsInsert,dsEdit] then adsPur510.Post;
qryPur510B.Close;
qryPur510B.SQL.Clear;
qryPur510B.SQL.Add('delete from PUR510B where P510B_001='+''''+edtCode.Text+'''');
qryPur510B.ExecSQL;
if AMode='ADD' then
begin
ADOQuery1.Append;
ADOQuery1.FieldByName('P510A_004').Value:=0; //新建
ADOQuery1.FieldByName('P510A_022').AsString:=edtCreateDate.Text; //制单日期
ADOQuery1.FieldByName('P510A_023').AsString:=edtCreateBy.Text; //制单人员
ADOQuery1.FieldByName('P510A_024').AsString:=edtUpdateDate.Text; //修改日期
ADOQuery1.FieldByName('P510A_025').AsString:=edtUpdateBy.Text; //修改人员
end else
begin
ADate:=GetServerDate;
ADOQuery1.Edit;
ADOQuery1.FieldByName('P510A_024').Value:=ADate; //修改日期
ADOQuery1.FieldByName('P510A_025').Value:=AUserName; //修改人员
end;
ADOQuery1.FieldByName('P510A_002').Value:=qryPur100.FieldByName('P100_001').Value; //采购类型
ADOQuery1.FieldByName('P510A_003').Value:=edtDate.Date; //采购日期
ADOQuery1.FieldByName('P510A_005').Value:=null;
if trim(edtPerson.Text)<>'' then ADOQuery1.FieldByName('P510A_005').Value:=qryHrm150.FieldByName('H150_001').Value; //采购人员
ADOQuery1.FieldByName('P510A_006').Value:=cbFrom.ItemIndex; //来源类型
ADOQuery1.FieldByName('P510A_007').Value:=ACurrNo;
ADOQuery1.FieldByName('P510A_008').AsString:=edtRate.Text; //币别汇率
ADOQuery1.FieldByName('P510A_009').Value:=APayment; //付款方式
ADOQuery1.FieldByName('P510A_010').AsString:=edtCheckDate.Text; //审核日期
ADOQuery1.FieldByName('P510A_011').AsString:=edtChecker.Text; //审核人员
ADOQuery1.FieldByName('P510A_012').Value:=StrToFloatA(edtAmount.Text); //金额总计
ADOQuery1.FieldByName('P510A_013').Value:=StrToFloatA(edtDisRate.Text); //折扣比率
ADOQuery1.FieldByName('P510A_014').Value:=StrToFloatA(edtDiscount.Text); //折扣金额
ADOQuery1.FieldByName('P510A_015').Value:=StrToFloatA(edtSumCharge.Text); //特殊费用
ADOQuery1.FieldByName('P510A_016').Value:=StrToFloatA(edtNetAmt.Text); //应收金额
ADOQuery1.FieldByName('P510A_017').Value:=ACustNo; //客户编号
ADOQuery1.FieldByName('P510A_018').Value:=edtPlace.Text; //交货地址
ADOQuery1.FieldByName('P510A_019').Value:=cbPick.ItemIndex; //提货方式(0=自提,1=送货,2=托运,3=邮寄,4=快递)
ADOQuery1.FieldByName('P510A_020').AsString:=memTerm.Text; //采购条款
ADOQuery1.FieldByName('P510A_021').AsString:=memRemark.Text; //备注说明
ADOQuery1.FieldByName('P510A_026').AsString:=edtPlaceContact.Text; //联系人名
ADOQuery1.FieldByName('P510A_027').AsInteger:=UpDown1.Position; //优先级别
if qryOrd1501.Locate('O150_002',edtCust1.Text,[]) then
begin
ACustNo1:=qryOrd1501.FieldByName('O150_001').AsInteger;
ADOQuery1.FieldByName('P510A_028').AsInteger:=ACustNo1; //客户编号
end;
if AItemNo<>0 then
begin
ADOQuery1.FieldByName('P510A_029').Value:=AItemNo; //产品编号
ADOQuery1.FieldByName('P510A_030').AsString:=edtMacNo.Text; //机身编号
end;
end;
procedure TPur510_02Form.UpdateEvent;
begin
inherited;
//0=新建,1=核准,2=执行,3=收货,4=完成,5=取消
if ADOQuery1.FieldByName('P510A_004').AsInteger<>0 then
begin
ShowMsg('UMS10000639'); //不允许修改非新建状态的采购定单
Abort;
end;
SetDBGrid;
end;
//取得明细表数据
procedure TPur510_02Form.GetDetailData;
begin
ALastNo:=0;
adsPur510B.DisableControls;
adsPur510.DisableControls;
adsPur510B.Close;
adsPur510B.CreateDataSet;
SetDBGrid;
adsPur510.Close;
adsPur510.CreateDataSet;
qryPur510B.Close;
qryPur510B.SQL.Clear;
qryPur510B.SQL.Add('select A.*,B.I150_002,B.I150_003,B.I150_008,B.I150_004,C.I140_002,C.I140_003');
qryPur510B.SQL.Add('from (PUR510B A left join INV150 B on A.P510B_003=B.I150_001) left join INV140 C on A.P510B_004=C.I140_001');
qryPur510B.SQL.Add('where A.P510B_001='+''''+edtCode.Text+'''');
qryPur510B.SQL.Add('order by P510B_002');
qryPur510B.Open;
while not qryPur510B.Eof do
begin
if qryPur510B.FieldByName('P510B_018').AsInteger=2 then
begin
adsPur510.Append;
adsPur510.FieldByName('FNo').Value:=qryPur510B.FieldByName('P510B_002').Value;
adsPur510.FieldByName('FItemNo').Value:=qryPur510B.FieldByName('P510B_003').Value;
adsPur510.FieldByName('FItemID').Value:=qryPur510B.FieldByName('I150_002').Value;
adsPur510.FieldByName('FItemName').Value:=qryPur510B.FieldByName('I150_003').Value;
adsPur510.FieldByName('FEngItemName').Value:=qryPur510B.FieldByName('I150_008').Value;
adsPur510.FieldByName('FItemSpec').Value:=qryPur510B.FieldByName('I150_004').Value;
adsPur510.FieldByName('FUnitNo').Value:=qryPur510B.FieldByName('P510B_004').Value;
adsPur510.FieldByName('FUnitID').Value:=qryPur510B.FieldByName('I140_002').Value;
adsPur510.FieldByName('FUnitName').Value:=qryPur510B.FieldByName('I140_003').Value;
adsPur510.FieldByName('FQty').Value:=qryPur510B.FieldByName('P510B_005').Value;
adsPur510.FieldByName('FPrice').Value:=qryPur510B.FieldByName('P510B_006').Value;
adsPur510.FieldByName('FAmount').Value:=qryPur510B.FieldByName('P510B_007').Value;
adsPur510.FieldByName('FDisRate').Value:=qryPur510B.FieldByName('P510B_008').Value;
adsPur510.FieldByName('FDisAmt').Value:=qryPur510B.FieldByName('P510B_009').Value;
adsPur510.FieldByName('FNetAmt').Value:=qryPur510B.FieldByName('P510B_010').Value;
adsPur510.FieldByName('FTax').Value:=qryPur510B.FieldByName('P510B_011').Value;
adsPur510.FieldByName('FTaxAmt').Value:=qryPur510B.FieldByName('P510B_012').Value;
adsPur510.FieldByName('FAcrAmt').Value:=qryPur510B.FieldByName('P510B_013').Value;
adsPur510.FieldByName('FDate').Value:=qryPur510B.FieldByName('P510B_014').Value;
adsPur510.FieldByName('FFactDate').Value:=qryPur510B.FieldByName('P510B_015').Value;
adsPur510.FieldByName('FReceQty').Value:=qryPur510B.FieldByName('P510B_016').Value;
adsPur510.FieldByName('FPlace').Value:=qryPur510B.FieldByName('P510B_017').Value;
adsPur510.FieldByName('FFromID').Value:=qryPur510B.FieldByName('P510B_019').Value;
adsPur510.FieldByName('FLineNo').Value:=qryPur510B.FieldByName('P510B_020').Value;
adsPur510.FieldByName('FRemark').Value:=qryPur510B.FieldByName('P510B_021').Value;
adsPur510.FieldByName('FReturn').Value:=qryPur510B.FieldByName('P510B_022').Value;
adsPur510.FieldByName('FUnitRate').Value:=qryPur510B.FieldByName('P510B_023').Value;
adsPur510.FieldByName('FInvoice').Value:=qryPur510B.FieldByName('P510B_024').Value;
adsPur510.FieldByName('FDiscount').Value:=qryPur510B.FieldByName('P510B_025').Value;
adsPur510.FieldByName('FTotalAmt').Value:=qryPur510B.FieldByName('P510B_026').Value;
adsPur510.FieldByName('FInAmount').Value:=qryPur510B.FieldByName('P510B_027').Value;
adsPur510.Post;
end else
begin
adsPur510B.Append;
adsPur510B.FieldByName('FNo').Value:=qryPur510B.FieldByName('P510B_002').Value;
adsPur510B.FieldByName('FItemNo').Value:=qryPur510B.FieldByName('P510B_003').Value;
adsPur510B.FieldByName('FItemID').Value:=qryPur510B.FieldByName('I150_002').Value;
adsPur510B.FieldByName('FItemName').Value:=qryPur510B.FieldByName('I150_003').Value;
adsPur510B.FieldByName('FEngItemName').Value:=qryPur510B.FieldByName('I150_008').Value;
adsPur510B.FieldByName('FItemSpec').Value:=qryPur510B.FieldByName('I150_004').Value;
adsPur510B.FieldByName('FUnitNo').Value:=qryPur510B.FieldByName('P510B_004').Value;
adsPur510B.FieldByName('FUnitID').Value:=qryPur510B.FieldByName('I140_002').Value;
adsPur510B.FieldByName('FUnitName').Value:=qryPur510B.FieldByName('I140_003').Value;
adsPur510B.FieldByName('FQty').Value:=qryPur510B.FieldByName('P510B_005').Value;
adsPur510B.FieldByName('FPrice').Value:=qryPur510B.FieldByName('P510B_006').Value;
adsPur510B.FieldByName('FAmount').Value:=qryPur510B.FieldByName('P510B_007').Value;
adsPur510B.FieldByName('FDisRate').Value:=qryPur510B.FieldByName('P510B_008').Value;
adsPur510B.FieldByName('FDisAmt').Value:=qryPur510B.FieldByName('P510B_009').Value;
adsPur510B.FieldByName('FNetAmt').Value:=qryPur510B.FieldByName('P510B_010').Value;
adsPur510B.FieldByName('FTax').Value:=qryPur510B.FieldByName('P510B_011').Value;
adsPur510B.FieldByName('FTaxAmt').Value:=qryPur510B.FieldByName('P510B_012').Value;
adsPur510B.FieldByName('FAcrAmt').Value:=qryPur510B.FieldByName('P510B_013').Value;
adsPur510B.FieldByName('FDate').Value:=qryPur510B.FieldByName('P510B_014').Value;
adsPur510B.FieldByName('FFactDate').Value:=qryPur510B.FieldByName('P510B_015').Value;
adsPur510B.FieldByName('FReceQty').Value:=qryPur510B.FieldByName('P510B_016').Value;
adsPur510B.FieldByName('FPlace').Value:=qryPur510B.FieldByName('P510B_017').Value;
adsPur510B.FieldByName('FFromID').Value:=qryPur510B.FieldByName('P510B_019').Value;
adsPur510B.FieldByName('FLineNo').Value:=qryPur510B.FieldByName('P510B_020').Value;
adsPur510B.FieldByName('FRemark').Value:=qryPur510B.FieldByName('P510B_021').Value;
adsPur510B.FieldByName('FReturn').Value:=qryPur510B.FieldByName('P510B_022').Value;
adsPur510B.FieldByName('FUnitRate').Value:=qryPur510B.FieldByName('P510B_023').Value;
adsPur510B.FieldByName('FInvoice').Value:=qryPur510B.FieldByName('P510B_024').Value;
adsPur510B.FieldByName('FDiscount').Value:=qryPur510B.FieldByName('P510B_025').Value;
adsPur510B.FieldByName('FTotalAmt').Value:=qryPur510B.FieldByName('P510B_026').Value;
adsPur510B.FieldByName('FInAmount').Value:=qryPur510B.FieldByName('P510B_027').Value;
adsPur510B.Post;
end;
ALastNo:=qryPur510B.FieldByName('P510B_002').AsInteger;
qryPur510B.Next;
end;
adsPur510B.EnableControls;
adsPur510.EnableControls;
end;
procedure TPur510_02Form.ADOQuery1P510A_004GetText(Sender: TField;
var Text: String; DisplayText: Boolean);
begin
inherited;
if ADOQuery1.IsEmpty then Exit;
Text:=AStatus[Sender.AsInteger];
end;
procedure TPur510_02Form.ADOQuery1P510A_006GetText(Sender: TField;
var Text: String; DisplayText: Boolean);
begin
inherited;
if ADOQuery1.IsEmpty then Exit;
Text:=AFrom[Sender.AsInteger];
end;
procedure TPur510_02Form.ADOQuery1P510A_019GetText(Sender: TField;
var Text: String; DisplayText: Boolean);
begin
inherited;
if ADOQuery1.IsEmpty then Exit;
Text:=APick[Sender.AsInteger];
end;
procedure TPur510_02Form.sbPersonClick(Sender: TObject);
begin
inherited;
//采购人员查询
if not edtPerson.Focused then edtPerson.SetFocus;
HwSelDataForm:=THwSelDataForm.Create(Application);
HwSelDataForm.OpenSelData(qryHrm150,nil);
if HwSelDataForm.ShowModal=1 then
begin
edtPerson.Text:=qryHrm150.FieldByName('H150_002').AsString;
edtPersonName.Text:=qryHrm150.FieldByName('H150_003').AsString;
end;
end;
procedure TPur510_02Form.edtPersonExit(Sender: TObject);
begin
inherited;
//采购人员
if trim(edtPerson.Text)='' then Exit;
if qryHrm150.Locate('H150_002',edtPerson.Text,[]) then
begin
edtPerson.Text:=qryHrm150.FieldByName('H150_002').AsString;
edtPersonName.Text:=qryHrm150.FieldByName('H150_003').AsString;
end else
begin
ShowMsg('UMS10000556'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -