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

📄 pur510_02.pas.svn-base

📁 这是一个功能齐全的,代码完整的ERP企业信息管理系统,现在上传和大家分享
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
    begin
      edtPlaceContact.Text:=qryOrd151.FieldByName('O151_002').AsString;
      edtPlaceDept.Text:=qryOrd151.FieldByName('O151_003').AsString;
      edtPlacePhone.Text:=qryOrd151.FieldByName('O151_005').AsString;
      edtPlaceFax.Text:=qryOrd151.FieldByName('O151_006').AsString;
      edtPlacePosit.Text:=qryOrd151.FieldByName('O151_004').AsString;
      edtPlaceDept.Text:=qryOrd151.FieldByName('O151_003').AsString;
    end;
  end;
  AOldCustNo:=ADOQuery1.FieldByName('P510A_017').AsInteger;
  GetDetailData;
  wwDBGrid1UpdateFooter(wwDBGrid1);
end;

procedure TPur510_02Form.InsertEvent;
var
  ADate:TDateTime;
begin
  inherited;
  ADate:=GetServerDate;
  edtCode.Text:='';
  cbType.ItemIndex:=0;
  qryPur100.Locate('P100_002',cbType.Text,[]);
  edtDate.Date:=ADate;
  edtStatus.Text:=AStatus[0];
  edtPerson.Text:='';
  cbPick.ItemIndex:=0;
  //币别=本位币
  qryGld100.Locate('G100_003',ACurrName,[]);
  cbCurr.ItemIndex:=cbCurr.Items.IndexOf(ACurrName);
  edtRate.Text:='1';
  cbPayment.ItemIndex:=0;
  qryGld110.Locate('G110_002',cbPayment.Text,[]);
  edtCheckDate.Clear;
  edtChecker.Text:='';

  edtAmount.Text:='0.00';
  edtDisRate.Text:='0.00';
  edtDiscount.Text:='0.00';
  edtSumCharge.Text:='0.00';
  edtNetAmt.Text:='0.00';

  edtCust.Text:='';
  edtCustName.Text:='';
  edtCust.Text:='';
  edtPhone.Text:='';
  edtAddress.Text:='';
  edtFax.Text:='';
  edtContact.Text:='';
  edtDept.Text:='';
  edtPosit.Text:='';

  edtPlace.Text:='';
  edtRegion.Text:='';
  edtPlacePhone.Text:='';
  edtPlaceAddress.Text:='';
  edtPlaceFax.Text:='';
  edtPlaceContact.Text:='';
  edtPlaceDept.Text:='';
  edtPlacePosit.Text:='';

  memTerm.Text:='';
  memRemark.Text:='';

  edtDate.Date:=ADate;
  edtCreateDate.Text:=FormatDateTime('yyyy-mm-dd hh:mm:ss',ADate);
  edtCreateBy.Text:=AUserName;
  edtUpdateDate.Text:=FormatDateTime('yyyy-mm-dd hh:mm:ss',ADate);
  edtUpdateBy.Text:=AUserName;

  ALastNo:=0;
  adsPur510B.Close;
  adsPur510B.CreateDataSet;
  adsPur510.Close;
  adsPur510.CreateDataSet;
  PageControl1.ActivePageIndex:=0;
  PageControl2.ActivePageIndex:=0;
  SetDBGrid;
end;

procedure TPur510_02Form.ReportGetValue(const ParName: String;
  var ParValue: Variant);
begin
  inherited;
  if ParName='AAmount' then ParValue:=ADOQuery1.FieldByName('P510A_012').AsString  //金额总计
  else if ParName='ADicount' then ParValue:=ADOQuery1.FieldByName('P510A_014').AsString  //折扣金额
  else if ParName='ACharge' then ParValue:=ADOQuery1.FieldByName('P510A_015').AsString  //特殊费用
  else if ParName='ANetAmt' then ParValue:=ADOQuery1.FieldByName('P510A_016').AsString  //应收金额
  else if ParName='ATerm' then ParValue:=ADOQuery1.FieldByName('P510A_020').AsString  //採購條款
  else if ParName='ARemark' then ParValue:=ADOQuery1.FieldByName('P510A_021').AsString  //备注說明
{
  else if ParName='I150_002'      then ParValue:= qryOrd153.fieldByName('I150_002').Value  //产品编号
  else if ParName='O153_003'      then ParValue:= qryOrd153.fieldByName('O153_003').Value  //机身编号
  else if ParName='I150_003'      then ParValue:= qryOrd153.fieldByName('I150_003').Value  //产品名称
  else if ParName='I150_004'      then ParValue:= qryOrd153.fieldByName('I150_004').Value  //规格型号
  else if ParName='I120_003'      then ParValue:= qryOrd153.fieldByName('I120_003').Value  //产品类别
  else if ParName='O150_002'      then ParValue:= qryOrd153.fieldByName('O150_002').Value  //制造商号
  else if ParName='O150_003'      then ParValue:= qryOrd153.fieldByName('O150_003').Value  //制造商名
  else if ParName='I150_001'      then ParValue:= qryOrd153.fieldByName('I150_001').Value //
}
  else if ParName='PlaceContact'  then ParValue:=edtPlaceContact.Text
  else if ParName='PlaceDept'     then ParValue:=edtPlaceDept.Text
  else if ParName='PlacePhone'    then ParValue:=edtPlacePhone.Text
  else if ParName='PlaceFax'      then ParValue:=edtPlaceFax.Text
  else if ParName='PlacePosit'    then ParValue:=edtPlacePosit.Text
  else if ParName='PlaceDept'     then ParValue:=edtPlaceDept.Text
  else if ParName='ACurrency'     then ParValue:=cbCurr.Text
  else if ParName='I150_002'           then ParValue:= edtItemID.Text  //产品编号
  else if ParName='O153_003'      then ParValue:= edtMacNo.Text  //机身编号
  else if ParName='O153_004'      then ParValue:= edtControllerNo.Text  //控制器号

end;

procedure TPur510_02Form.SetEmptyInit;
begin
  inherited;
  edtCode.Text:='';
  cbType.ItemIndex:=0;
  qryPur100.Locate('P100_002',cbType.Text,[]);
  edtDate.Date:=GetServerDate;
  edtStatus.Text:=AStatus[0];
  edtPerson.Text:='';
  cbPick.ItemIndex:=0;
  cbCurr.ItemIndex:=-1;
  edtRate.Text:='1';
  cbPayment.ItemIndex:=0;
  qryGld110.Locate('G110_001',cbPayment.Text,[]);
  cbFrom.ItemIndex:=0;
  edtCheckDate.Clear;
  edtChecker.Text:='';

  edtAmount.Text:='0.00';
  edtDisRate.Text:='0.00';
  edtDiscount.Text:='0.00';
  edtSumCharge.Text:='0.00';
  edtNetAmt.Text:='0.00';

  edtCust.Text:='';
  edtCustName.Text:='';
  edtCust.Text:='';
  edtPhone.Text:='';
  edtAddress.Text:='';
  edtFax.Text:='';
  edtContact.Text:='';
  edtDept.Text:='';
  edtPosit.Text:='';

  edtPlace.Text:='';
  edtRegion.Text:='';
  edtPlacePhone.Text:='';
  edtPlaceAddress.Text:='';
  edtPlaceFax.Text:='';
  edtPlaceContact.Text:='';
  edtPlaceDept.Text:='';
  edtPlacePosit.Text:='';

  memTerm.Text:='';
  memRemark.Text:='';

  edtCreateDate.Text:='';
  edtCreateBy.Text:='';
  edtUpdateDate.Text:='';
  edtUpdateBy.Text:='';

  ALastNo:=0;
  adsPur510B.Close;
  adsPur510B.CreateDataSet;
  adsPur510.Close;
  adsPur510.CreateDataSet;
end;

procedure TPur510_02Form.TableAfterPost;
begin
  inherited;
  qryPur510B.Close;
  qryPur510B.SQL.Clear;
  qryPur510B.SQL.Add('select * from PUR510B where P510B_001='+''''+edtCode.Text+''''+' order by P510B_001,P510B_002');
  qryPur510B.Open;
  if adsPur510B.State in [dsInsert,dsEdit] then adsPur510B.Post;
  adsPur510B.First;
  while not adsPur510B.Eof do
  begin
    qryPur510B.Append;
    qryPur510B.FieldByName('P510B_001').Value:=edtCode.Text;
    qryPur510B.FieldByName('P510B_002').Value:=adsPur510B.FieldByName('FNo').Value;
    qryPur510B.FieldByName('P510B_003').Value:=adsPur510B.FieldByName('FItemNo').Value;
    qryPur510B.FieldByName('P510B_004').Value:=adsPur510B.FieldByName('FUnitNo').Value;
    qryPur510B.FieldByName('P510B_005').Value:=adsPur510B.FieldByName('FQty').Value;
    qryPur510B.FieldByName('P510B_006').Value:=adsPur510B.FieldByName('FPrice').Value;
    qryPur510B.FieldByName('P510B_007').Value:=adsPur510B.FieldByName('FAmount').Value;
    qryPur510B.FieldByName('P510B_008').Value:=adsPur510B.FieldByName('FDisRate').Value;
    qryPur510B.FieldByName('P510B_009').Value:=adsPur510B.FieldByName('FDisAmt').Value;
    qryPur510B.FieldByName('P510B_010').Value:=adsPur510B.FieldByName('FNetAmt').Value;
    qryPur510B.FieldByName('P510B_011').Value:=adsPur510B.FieldByName('FTax').Value;
    qryPur510B.FieldByName('P510B_012').Value:=adsPur510B.FieldByName('FTaxAmt').Value;
    qryPur510B.FieldByName('P510B_013').Value:=adsPur510B.FieldByName('FAcrAmt').Value;
    qryPur510B.FieldByName('P510B_014').Value:=adsPur510B.FieldByName('FDate').Value;
    qryPur510B.FieldByName('P510B_015').Value:=adsPur510B.FieldByName('FFactDate').Value;
    if AMode='ADD' then
      qryPur510B.FieldByName('P510B_016').Value:=0
    else
      qryPur510B.FieldByName('P510B_016').Value:=adsPur510B.FieldByName('FReceQty').Value;
    qryPur510B.FieldByName('P510B_017').Value:=adsPur510B.FieldByName('FPlace').Value;
    qryPur510B.FieldByName('P510B_018').Value:=0;
    qryPur510B.FieldByName('P510B_019').Value:=adsPur510B.FieldByName('FFromID').Value;
    qryPur510B.FieldByName('P510B_020').Value:=adsPur510B.FieldByName('FLineNo').Value;
    qryPur510B.FieldByName('P510B_021').Value:=adsPur510B.FieldByName('FRemark').Value;
    qryPur510B.FieldByName('P510B_022').Value:=adsPur510B.FieldByName('FReturn').Value;
    qryPur510B.FieldByName('P510B_023').Value:=adsPur510B.FieldByName('FUnitRate').Value;
    qryPur510B.FieldByName('P510B_024').Value:=adsPur510B.FieldByName('FInvoice').AsFloat;
    qryPur510B.FieldByName('P510B_025').Value:=adsPur510B.FieldByName('FDiscount').AsFloat;
    qryPur510B.FieldByName('P510B_026').Value:=GetTotalAmt(adsPur510B.FieldByName('FAcrAmt').Value);
    qryPur510B.FieldByName('P510B_027').Value:=adsPur510B.FieldByName('FInAmount').AsFloat;
    qryPur510B.Post;
    adsPur510B.Next;
  end;
  //特殊费用
  if adsPur510.State in [dsInsert,dsEdit] then adsPur510.Post;
  adsPur510.First;
  while not adsPur510.Eof do
  begin
    qryPur510B.Append;
    qryPur510B.FieldByName('P510B_001').Value:=edtCode.Text;
    qryPur510B.FieldByName('P510B_002').Value:=adsPur510.FieldByName('FNo').Value;
    qryPur510B.FieldByName('P510B_003').Value:=adsPur510.FieldByName('FItemNo').Value;
    qryPur510B.FieldByName('P510B_004').Value:=adsPur510.FieldByName('FUnitNo').Value;
    qryPur510B.FieldByName('P510B_005').Value:=adsPur510.FieldByName('FQty').Value;
    qryPur510B.FieldByName('P510B_006').Value:=adsPur510.FieldByName('FPrice').Value;
    qryPur510B.FieldByName('P510B_007').Value:=adsPur510.FieldByName('FAmount').Value;
    qryPur510B.FieldByName('P510B_008').Value:=adsPur510.FieldByName('FDisRate').Value;
    qryPur510B.FieldByName('P510B_009').Value:=adsPur510.FieldByName('FDisAmt').Value;
    qryPur510B.FieldByName('P510B_010').Value:=adsPur510.FieldByName('FNetAmt').Value;
    qryPur510B.FieldByName('P510B_011').Value:=adsPur510.FieldByName('FTax').Value;
    qryPur510B.FieldByName('P510B_012').Value:=adsPur510.FieldByName('FTaxAmt').Value;
    qryPur510B.FieldByName('P510B_013').Value:=adsPur510.FieldByName('FAcrAmt').Value;
    qryPur510B.FieldByName('P510B_014').Value:=adsPur510.FieldByName('FDate').Value;
    qryPur510B.FieldByName('P510B_015').Value:=adsPur510.FieldByName('FFactDate').Value;
    qryPur510B.FieldByName('P510B_016').Value:=adsPur510.FieldByName('FReceQty').Value;
    qryPur510B.FieldByName('P510B_017').Value:=adsPur510.FieldByName('FPlace').Value;
    qryPur510B.FieldByName('P510B_018').Value:=2;
    qryPur510B.FieldByName('P510B_019').Value:=adsPur510.FieldByName('FFromID').Value;
    qryPur510B.FieldByName('P510B_020').Value:=adsPur510.FieldByName('FLineNo').Value;
    qryPur510B.FieldByName('P510B_021').Value:=adsPur510.FieldByName('FRemark').Value;
    qryPur510B.FieldByName('P510B_022').Value:=adsPur510.FieldByName('FReturn').Value;
    qryPur510B.FieldByName('P510B_023').Value:=adsPur510.FieldByName('FUnitRate').Value;
    qryPur510B.FieldByName('P510B_024').Value:=adsPur510.FieldByName('FInvoice').AsFloat;
    qryPur510B.FieldByName('P510B_025').Value:=adsPur510.FieldByName('FDiscount').AsFloat;
    qryPur510B.FieldByName('P510B_026').Value:=adsPur510.FieldByName('FAcrAmt').Value;
    qryPur510B.FieldByName('P510B_027').Value:=adsPur510.FieldByName('FInAmount').AsFloat;
    qryPur510B.Post;
    adsPur510.Next;
  end;
  //反写銷售定单状态为完成
  if cbFrom.ItemIndex=3 then
  begin
    SYSDM.qryQuery.Close;
    SYSDM.qryQuery.SQL.Clear;
    SYSDM.qryQuery.SQL.Add('update ORD510A set O510A_004=1 where exists(select 1 from PUR510B where P510B_019=O510A_001 and P510B_001='+''''+edtCode.Text+''''+')');
    SYSDM.qryQuery.ExecSQL;
  end;
end;

procedure TPur510_02Form.TableBeforePost;
var
  ADate:TDateTime;
  AItemNo,ACustNo,ACurrNo,APayment,ACustNo1:Integer;
begin
  inherited;
  AItemNo:=0;
  if trim(cbType.Text)='' then
  begin
    ShowMsg('UMS10000554');  //采购类型不能为空
    cbType.SetFocus;
    Abort;
  end;
  qryPur100.Locate('P100_002',cbType.Text,[]);
  if trim(edtDate.Text)='' then
  begin
    ShowMsg('UMS10000555');  //采购日期不能为空
    edtDate.SetFocus;
    Abort;
  end;
  if not qryGld100.Locate('G100_003',cbCurr.Text,[]) then
  begin
    ShowMsg('UMS10000412');  //输入的币别编号无效
    cbCurr.SetFocus;
    Abort;
  end;
  ACurrNo:=qryGld100.FieldByName('G100_001').AsInteger;
  if not qryGld110.Locate('G110_002',cbPayment.Text,[]) then
  begin
    ShowMsg('UMS10000528');  //无效的付款方式
    cbPayment.SetFocus;
    Abort;
  end;
  APayment:=qryGld110.FieldByName('G110_001').AsInteger;
  if trim(edtPerson.Text)<>'' then
  begin
    if not qryHrm150.Locate('H150_002',edtPerson.Text,[]) then
    begin
      ShowMsg('UMS10000556');  //输入的采购人员无效
      edtPerson.SetFocus;

⌨️ 快捷键说明

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