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

📄 input.pas

📁 材料管理系统
💻 PAS
📖 第 1 页 / 共 2 页
字号:
      jiecunshu  := FloatToStr(StrToFloat(kucunshu)+StrToFloat(rukushu)-StrToFloat(chukushu));
      jiecunjine := FloatToStr(StrToFloat(kucunjine)+StrToFloat(rukujine)-StrToFloat(chukujine));
      Query1.Close;
      Query1.SQL.Clear;
      Query1.SQL.Add('Update MonthHaoCai set rukushu='''+Format('%.2f',[StrToFloat(rukushu)])+''',rukujine='''+
        Format('%.2f',[StrToFloat(rukujine)])+''',jiecunshu='''+Format('%.2f',[StrToFloat(jiecunshu)])+''',jiecunjine='''+
        Format('%.2f',[StrToFloat(jiecunjine)])+''' where class='''+clclass+''' and cailiaoming='''+Edit1.Text+''' and riqi='''+
        riqi+'''');
      Query1.ExecSQL;
      Query1.Close;
      Query1.SQL.Clear;
      Query1.SQL.Add('Update MonthDataCache set rukushu='''+Format('%.2f',[StrToFloat(rukushu)])+''',rukujine='''+
        Format('%.2f',[StrToFloat(rukujine)])+''' where class='''+clclass+''' and cailiaoming='''+Edit1.Text+'''');
      Query1.ExecSQL;

      Query1.Close;           {年}
      Query1.SQL.Clear;
      Query1.SQL.Add('Select max(nian) as maxYear from YearHaoCai where class='''+clclass+''' and cailiaoming='''+
        Edit1.Text+'''');
      Query1.Prepared;
      Query1.Open;
      if Not Query1.Eof then
        nian := Query1.FieldByName('maxYear').AsInteger;
      Query1.Close;
      Query1.SQL.Clear;
      Query1.SQL.Add('Select * from YearHaoCai where class='''+clclass+''' and cailiaoming='''+Edit1.Text+
        ''' and nian='+IntToStr(nian));
      Query1.Prepared;
      Query1.Open;
      if Not Query1.Eof then
      begin
        kucunshu   := Query1.FieldByName('kucunshu').AsString;
        kucunjine  := Query1.FieldByName('kucunjine').AsString;
        rukushu    := Query1.FieldByName('rukushu').AsString;
        //rukujine   := Query1.FieldByName('rukujine').AsString;
        chukushu   := Query1.FieldByName('chukushu').AsString;
        chukujine  := Query1.FieldByName('chukujine').AsString;
        //jiecunshu  := Query1.FieldByName('jiecunshu').AsString;
        //jiecunjine := Query1.FieldByName('jiecunjine').AsString;
      end;
      rukushu    := FloatToStr(StrToFloat(rukushu)+StrToFloat(values));
      rukujine   := FloatToStr(StrToFloat(rukushu)*StrToFloat(Edit3.Text));
      jiecunshu  := FloatToStr(StrToFloat(kucunshu)+StrToFloat(rukushu)-StrToFloat(chukushu));
      jiecunjine := FloatToStr(StrToFloat(kucunjine)+StrToFloat(rukujine)-StrToFloat(chukujine));
      Query1.Close;
      Query1.SQL.Clear;
      Query1.SQL.Add('Update YearHaoCai set rukushu='''+Format('%.2f',[StrToFloat(rukushu)])+
        ''',rukujine='''+Format('%.2f',[StrToFloat(rukujine)])+''',jiecunshu='''+Format('%.2f',[StrToFloat(jiecunshu)])+
        ''',jiecunjine='''+Format('%.2f',[StrToFloat(jiecunjine)])+''' where class='''+clclass+
        ''' and cailiaoming='''+Edit1.Text+''' and nian='+IntToStr(nian));
      Query1.ExecSQL;
      Query1.Close;
      Query1.SQL.Clear;
      Query1.SQL.Add('Update YearDataCache set rukushu='''+Format('%.2f',[StrToFloat(rukushu)])+
        ''',rukujine='''+Format('%.2f',[StrToFloat(rukujine)])+''' where class='''+clclass+
        ''' and cailiaoming='''+Edit1.Text+'''');
      Query1.ExecSQL;
    end;
  end
  else    {<多入}
  begin               {values为多入的数量}
    values := FloatToStr(StrToFloatDef(lastrukushu,0)-StrToFloatDef(Edit6.Text,0));
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add('Select max(nian) as maxYear from WeekHaoCai where class='''+clclass+''' and cailiaoming='''+Edit1.Text+'''');
    Query1.Prepared;
    Query1.Open;
    nian := Query1.FieldByName('maxYear').AsInteger;     //取得年
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add('Select max(zhou) as maxWeek from WeekHaoCai where class='''+clclass+''' and cailiaoming='''+Edit1.Text+
      ''' and nian='+IntToStr(nian));
    Query1.Prepared;
    Query1.Open;
    zhou := Query1.FieldByName('maxWeek').AsInteger; //取得周
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add('Select * from WeekHaoCai where class='''+ clclass+ ''' and nian='+IntToStr(nian)+
      ' and zhou='+IntToStr(zhou)+' and cailiaoming='''+Edit1.Text+'''');
    Query1.Prepared;
    Query1.Open;
    if Not Query1.Eof then
    begin
      kucunshu  := Query1.FieldByName('kucunshuliang').AsString;
      kucunjine := Query1.FieldByName('kucunjine').AsString;
      rukushu   := Query1.FieldByName('rukushuliang').AsString;
      //rukujine  := Query1.FieldByName('rukujine').AsString;
      chukushu  := Query1.FieldByName('chukushuliang').AsString;
      chukujine := Query1.FieldByName('chukujine').AsString;
    end;
    rukushu    := FloatToStr(StrToFloat(rukushu)-StrToFloat(values));
    rukujine   := FloatToStr(StrToFloat(rukushu)*StrToFloat(Edit3.Text));
    jiecunshu  := FloatToStr(StrToFloat(kucunshu)+StrToFloat(rukushu)-StrToFloat(chukushu));
    jiecunjine := FloatToStr(StrToFloat(kucunjine)+StrToFloat(rukujine)-StrToFloat(chukujine));
    Query1.Close;
    Query1.SQL.Clear;      {周}
    Query1.SQL.Add('Update WeekHaoCai set rukushuliang='''+Format('%.2f',[StrToFloat(rukushu)])+''',rukujine='''+Format('%.2f',[StrToFloat(rukujine)])+
      ''',jiecunshuliang='''+Format('%.2f',[StrToFloat(jiecunshu)])+''',jiecunjine='''+Format('%.2f',[StrToFloat(jiecunjine)])+''' where class='''+
      clclass+''' and cailiaoming='''+Edit1.Text+''' and nian='+IntToStr(nian)+' and zhou='+
      IntToStr(zhou));
    Query1.ExecSQL;
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add('Update WeekDataCache set rukushu='''+Format('%.2f',[StrToFloat(rukushu)])+''',rukujine='''+Format('%.2f',[StrToFloat(rukujine)])+
      ''' where class='''+clclass+''' and cailiaoming='''+Edit1.Text+'''');
    Query1.ExecSQL;

    Query1.Close;
    Query1.SQL.Clear;      {月}
    Query1.SQL.Add('Select max(riqi) as maxDate from MonthHaoCai where class='''+clclass+
      ''' and cailiaoming='''+Edit1.Text+'''');
    Query1.Prepared;
    Query1.Open;
    if Not Query1.Eof then
      riqi := Query1.FieldByName('maxDate').AsString;
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add('Select * from MonthHaoCai where class='''+clclass+''' and cailiaoming='''+
      Edit1.Text+''' and riqi='''+riqi+'''');
    Query1.Prepared;
    Query1.Open;      {提取数}
    kucunshu   := Query1.FieldByName('kucunshu').AsString;
    kucunjine  := Query1.FieldByName('kucunjine').AsString;
    rukushu    := Query1.FieldByName('rukushu').AsString;
    //rukujine   := Query1.FieldByName('rukujine').AsString;
    chukushu   := Query1.FieldByName('chukushu').AsString;
    chukujine  := Query1.FieldByName('chukujine').AsString;
    rukushu    := FloatToStr(StrToFloat(rukushu)-StrToFloat(values));
    rukujine   := FloatToStr(StrToFloat(rukushu)*StrToFloat(Edit3.Text));
    jiecunshu  := FloatToStr(StrToFloat(kucunshu)+StrToFloat(rukushu)-StrToFloat(chukushu));
    jiecunjine := FloatToStr(StrToFloat(kucunjine)+StrToFloat(rukujine)-StrToFloat(chukujine));
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add('Update MonthHaoCai set rukushu='''+Format('%.2f',[StrToFloat(rukushu)])+''',rukujine='''+Format('%.2f',[StrToFloat(rukujine)])+
      ''',jiecunshu='''+Format('%.2f',[StrToFloat(jiecunshu)])+''',jiecunjine='''+Format('%.2f',[StrToFloat(jiecunjine)])+''' where class='''+
      clclass+''' and cailiaoming='''+Edit1.Text+''' and riqi='''+riqi+'''');
    Query1.ExecSQL;
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add('Update MonthDataCache set rukushu='''+Format('%.2f',[StrToFloat(rukushu)])+''',rukujine='''+
      Format('%.2f',[StrToFloat(rukujine)])+''' where class='''+clclass+''' and cailiaoming='''+Edit1.Text+'''');
    Query1.ExecSQL;

    Query1.Close;           {年}
    Query1.SQL.Clear;
    Query1.SQL.Add('Select max(nian) as maxYear from YearHaoCai where class='''+clclass+''' and cailiaoming='''+
      Edit1.Text+'''');
    Query1.Prepared;
    Query1.Open;
    if Not Query1.Eof then
      nian := Query1.FieldByName('maxYear').AsInteger;
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add('Select * from YearHaoCai where class='''+clclass+''' and cailiaoming='''+Edit1.Text+
      ''' and nian='+IntToStr(nian));
    Query1.Prepared;
    Query1.Open;
    if Not Query1.Eof then
    begin
      kucunshu   := Query1.FieldByName('kucunshu').AsString;
      kucunjine  := Query1.FieldByName('kucunjine').AsString;
      rukushu    := Query1.FieldByName('rukushu').AsString;
      //rukujine   := Query1.FieldByName('rukujine').AsString;
      chukushu   := Query1.FieldByName('chukushu').AsString;
      chukujine  := Query1.FieldByName('chukujine').AsString;
      //jiecunshu  := Query1.FieldByName('jiecunshu').AsString;
      //jiecunjine := Query1.FieldByName('jiecunjine').AsString;
    end;
    rukushu    := FloatToStr(StrToFloat(rukushu)-StrToFloat(values));
    rukujine   := FloatToStr(StrToFloat(rukushu)*StrToFloat(Edit3.Text));
    jiecunshu  := FloatToStr(StrToFloat(kucunshu)+StrToFloat(rukushu)-StrToFloat(chukushu));
    jiecunjine := FloatToStr(StrToFloat(kucunjine)+StrToFloat(rukujine)-StrToFloat(chukujine));
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add('Update YearHaoCai set rukushu='''+Format('%.2f',[StrToFloat(rukushu)])+
      ''',rukujine='''+Format('%.2f',[StrToFloat(rukujine)])+''',jiecunshu='''+Format('%.2f',[StrToFloat(jiecunshu)])+
      ''',jiecunjine='''+Format('%.2f',[StrToFloat(jiecunjine)])+''' where class='''+clclass+
      ''' and cailiaoming='''+Edit1.Text+''' and nian='+IntToStr(nian));
    Query1.ExecSQL;
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add('Update YearDataCache set rukushu='''+Format('%.2f',[StrToFloat(rukushu)])+
      ''',rukujine='''+Format('%.2f',[StrToFloat(rukujine)])+''' where class='''+clclass+
      ''' and cailiaoming='''+Edit1.Text+'''');
    Query1.ExecSQL;
  end;
  Query1.Close;
  Query1.SQL.Clear;
  Query1.SQL.Add('Select * from LastWeekIn where class='''+clclass+''' and cailiaoming='''+Edit1.Text+'''');
  Query1.Prepared;
  Query1.Open;
  if Not Query1.Eof then
  begin
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add('Update LastWeekIn set lastrukushu='''+Edit6.Text+''',lastrukujine='''+Edit7.Text+
      ''' where class='''+clclass+''' and cailiaoming='''+Edit1.Text+'''');
    Query1.ExecSQL;
  end
  else
  begin
    Query1.Close;
    Query1.SQL.Clear;
    Query1.SQL.Add('Insert into LastWeekIn values('''+clclass+''','''+Edit1.Text+''','''+Edit6.Text+
      ''','''+Edit7.Text+''')');
    Query1.ExecSQL;
  end;
  FreeAndNil(Query1);
end;

end.

⌨️ 快捷键说明

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