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

📄 update_total_prices.pas

📁 公司ERP系统
💻 PAS
字号:
unit Update_Total_prices;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Db, DBTables;

type
  TForm1 = class(TForm)
    Button1: TButton;
    oeprepTable: TTable;
    Label1: TLabel;
    Query1: TQuery;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var vTotal_prices : Double;
begin
  Label1.caption := '磅︽い...';
  Label1.Refresh;
  oeprepTable.Open;
  oeprepTable.first;
  while not oeprepTable.eof do
  begin
    if (oeprepTable.FieldByName('currency').AsString = '') or
       (oeprepTable.FieldByName('currency').AsString = 'NTD') then
          vTotal_prices :=
          StrToFloat(formatFloat('0',oeprepTable.FieldByName('unit_price').AsFloat *
                                     oeprepTable.FieldByName('prep_qty').AsFloat))
    else
          vTotal_prices :=
          StrToFloat(formatFloat('0.000',oeprepTable.FieldByName('unit_price').AsFloat *
                                     oeprepTable.FieldByName('prep_qty').AsFloat));
    with Query1 do
    begin
      ParamByName('total_prices').AsFloat := vTotal_prices;
      ParamByName('slip_no').AsString     :=
        oeprepTable.FieldByName('slip_no').AsString;
      ParamByName('slip_seq').AsInteger     :=
        oeprepTable.FieldByName('slip_seq').AsInteger;
      ExecSQL;
    end;
    oeprepTable.Next;
  end;
  Label1.caption := '磅︽OK';
  Label1.Refresh;
end;

end.

⌨️ 快捷键说明

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