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

📄 unit_jihua.~pas

📁 此代码为企业原料管理代码
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
      temPer:=Qry_exe.fieldbyname('单价').asfloat;

     with Form_prjihua.t1  do
       begin
        open;
        append;
        fields[1].asstring:=Edit_dinghao.text;      //主表标识号
        fields[2].asstring:=Edit_MixCardNum.text;       //配方编号
        fields[3].asstring:=temName;       //材料名称
        fields[4].asfloat:=strtofloat(formatfloat('0.000',temWT));//temWT;       //领料数量
        fields[5].asfloat:=temPer;       //单价
        fields[6].asfloat:=strtofloat(formatfloat('0.00',temWT * temPer));//temWT * temPer; 金额
        fieldbyname('riqi').asdatetime:=strtodatetime(Edit1_riqi.text);
        post;
      end; //with

//填写计划单

      with TabMater do
        begin
        open;
        append;
        fields[1].asstring:=Edit_dinghao.text;      //主表标识号
        fields[2].asstring:=Edit_MixCardNum.text;       //配方编号
        fields[3].asstring:=temName;       //材料名称
        fields[4].asfloat:=strtofloat(formatfloat('0.000',temWT));//temWT;       //领料数量
        fields[5].asfloat:=temPer;       //单价
        fields[6].asfloat:=strtofloat(formatfloat('0.00',temWT * temPer));//temWT * temPer; 金额
        fieldbyname('riqi').asdatetime:=strtodatetime(Edit1_riqi.text);
        fieldbyname('jiaomi').asstring:=Edit_Rubbmi.text;
        fieldbyname('gjgg').asstring:=Edit_Per.text;
        fieldbyname('thgg').asstring:=Edit4.text;
        post;
      end; //with

    end; //if
    Qry_TakeCard.next;
  end; //while

    with Q1 do
    begin //求总金额
      close;
      sql.Clear;
      sql.Add('select sum(金额) as jinehe from jihuadan where 主表标识号 = :v_MixCardNum ');
      parambyname('v_MixCardNum').asstring:=Edit_dinghao.text;
      open;
      fWeight:=fieldbyname('jinehe').asfloat;
       //showmessage(floattostr(fieldbyname('jinehe').asfloat));
    end; //with
     // showmessage(floattostr(fWeight));
     with Q1 do
    begin //求弹簧总价
      close;
      sql.Clear;
      sql.Add('select 单价 from 原材料台帐 where 材料名称 = :v_MixCardNum and 最后领料标识=:tu');
      parambyname('v_MixCardNum').asstring:=Edit4.Text;
      parambyname('tu').asboolean:=true;
      open;
      zongfen:=fieldbyname('单价').asfloat;
      zongfen:=strtofloat(formatfloat('0.00',zongfen));
       zongfen:=zongfen*strtofloat(edit_tanhu.text);
       zongfen:=strtofloat(formatfloat('0.00',zongfen));
    end; //with

     with Q1 do
    begin //求骨架总价
      close;
      sql.Clear;
      sql.Add('select 单价 from 原材料台帐 where 材料名称 = :v_MixCardNum and 最后领料标识=:tu');
      parambyname('v_MixCardNum').asstring:=Edit_Per.Text;
      parambyname('tu').asboolean:=true;
      open;
      meifenzho:=fieldbyname('单价').asfloat;
      meifenzho:=strtofloat(formatfloat('0.00',meifenzho));
       meifenzho:=meifenzho*strtofloat(edit_gujia.text);
       meifenzho:=strtofloat(formatfloat('0.00',meifenzho));
    end; //with
       temPer:= meifenzho+ zongfen+fWeight;
     Edit6.Text:= floattostr(temPer);
     with Form_dinginput.table1 do
       begin
       open;
       edit;
       fieldbyname('touru').asfloat:=temPer;
       post;
       close;
       end;

    //======= glag字段改写成"t" 即做过计划
    with query3 do
    begin
      close;
      sql.clear;
      sql.Add('update dinghuodan.db set flag = :v_L ');
      sql.Add('where xuhao  = :xu ');
      parambyname('xu').asstring:=Edit_dinghao.text;
      parambyname('v_L').asstring:='t';
      execsql;
    end;
   messagedlg('计划已做好!', mtinformation, [mbok],0);
 end;

procedure TForm_jihua.Edit_MixCardNumChange(Sender: TObject);
begin
 if Edit_MixCardNum.text='' then
    begin
      showmessage('库内没有保存配方单,请输入配方单!');
      exit;
    end;
  with Qry_exe  do
  begin
    close;
    sql.clear;
    sql.add('select  * from 炼胶配方表 where 配方编号 = :v_MixCardNum ');
    parambyname('v_MixCardNum').asinteger:=strtoint(Edit_MixCardNum.text);
    open;
   // Edit_rubb.text:= fieldbyname('制成品名称').asstring;
    if fieldbyname('百分比').asfloat = 0 then
      b_state:=0  //是份数配方
    else
    begin
      b_state:=1;
    end;
  end;//with
end;

procedure TForm_jihua.Button2Click(Sender: TObject);
begin
 if edit2.text='11' then
 begin
 Form_dinginput.Visible:=true;
 edit2.text:=' ';
 end;
 Qry_TakeCard.Close;
 close;
end;

procedure TForm_jihua.FormShow(Sender: TObject);
begin
 if edit2.text<>'11' then
 begin
 DateTimePicker1.date:=date;
 Edit1_shehao.Text:='';
 Edit_dep.Text:='';
 edit_p.Text:='';
 Edit_tuhao.Text:='';
 Edit1_riqi.Text:='';
 Edit2_shuli.Text:='';
 Edit_MixCardNum.Text:='';
 Edit_Rubbmi.Text:='';
 eTotal.Text:='';
 Edit4.Text:='';
 edit_tanhu.Text:='';
 Edit_Per.Text:='';
 edit_gujia.Text:='';
 Edit6.Text:='';
 Edit_dinghao.SetFocus;
 end
 else
 begin
 DateTimePicker1.date:=date;
 Edit1_shehao.Text:='';
 Edit_MixCardNum.Text:='';
 Edit_Rubbmi.Text:='';
 eTotal.Text:='';
 Edit4.Text:='';
 edit_tanhu.Text:='';
 Edit_Per.Text:='';
 edit_gujia.Text:='';
 Edit6.Text:='';
 Edit1_shehao.SetFocus;
 end;
end;



procedure TForm_jihua.Edit4Change(Sender: TObject);
begin
   with Qry_exe  do
  begin
    close;
    sql.clear;
    sql.add('select * from 原材料字典 where 简称 = :v_index ');
    parambyname('v_index').asstring:=Edit4.text;
    open;
    if recordcount = 0 then exit;
    Edit4.text:= fieldbyname('材料名称').asstring;
  end;//with
end;

procedure TForm_jihua.Edit_PerChange(Sender: TObject);
begin
   with Qry_exe  do
  begin
    close;
    sql.clear;
    sql.add('select * from 原材料字典 where 简称 = :v_index ');
    parambyname('v_index').asstring:=Edit_Per.text;
    open;
    if recordcount = 0 then exit;
    Edit_Per.text:= fieldbyname('材料名称').asstring;
  end;//with
end;

procedure TForm_jihua.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if key = #13 then
  begin
    key:=#0;
    perform(WM_NEXTDLGCTL,0,0);
  end; //if
end;

procedure TForm_jihua.Edit1_shehaoExit(Sender: TObject);
begin
 (sender as TEdit).color := clwindow;
 Edit4.SetFocus;
end;

procedure TForm_jihua.Edit1_shehaoEnter(Sender: TObject);
begin
  (sender as TEdit).color := claqua;
end;

procedure TForm_jihua.Edit_dinghaoExit(Sender: TObject);
begin
 (sender as TEdit).color := clwindow;
end;


procedure TForm_jihua.BitBtn2Click(Sender: TObject);
begin
    Form_prjihua.QRLabel28.caption:=Edit_dinghao.text;
    Form_prjihua.QRLabel29.caption:=Edit_dep.text;
    Form_prjihua.QRLabel30.caption:=edit_p.text;
    Form_prjihua.QRLabel31.caption:=Edit_tuhao.text;
    Form_prjihua.QRLabel42.caption:=Edit2_shuli.text;
    Form_prjihua.QRLabel35.caption:=Edit_Rubbmi.text;
    Form_prjihua.QRLabel37.caption:=Edit_Per.text;
    Form_prjihua.QRLabel38.caption:=edit_gujia.text;
    Form_prjihua.QRLabel39.caption:=Edit4.text;
    Form_prjihua.QRLabel40.caption:=edit_tanhu.text;
    Form_prjihua.QRLabel41.caption:=Edit6.text;
    Form_prjihua.QRLabel32.caption:=Edit1_riqi.text;
    Form_prjihua.QRLabel33.caption:=datetostr(DateTimePicker1.date);
    Form_prjihua.QRLabel36.caption:=Edit1.text;
  Form_prjihua.QuickRep1.Preview;
end;

procedure TForm_jihua.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Edit_dinghao.Text:='';
   if edit2.text='11' then
 begin
 Form_dinginput.Visible:=true;
 edit2.text:=' ';
 end;
 Qry_TakeCard.Close;
end;

procedure TForm_jihua.Edit1Enter(Sender: TObject);
begin
  //TDBEdit(Sender).color:=claqua;
    FrmcommqueryID.PageControl1.ActivePageIndex:=0;
    FrmcommqueryID.ActiveControl:=FrmcommqueryID.estaffID;
    if  FrmcommqueryID.showmodal=mrok then
    begin
      Edit1.text:=FrmcommqueryID.query3.fieldbyname('staffname').asstring;
   end;
end;



end.


⌨️ 快捷键说明

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