📄 ckdj.pas
字号:
unit ckdj;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, DB, ADODB, SUIButton, SUIMemo, SUIEdit,
SUIComboBox, SUIImagePanel, SUIGroupBox, ExtCtrls, SUIForm;
type
Tckdjfrm = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label13: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label8: TLabel;
ADOQuery1: TADOQuery;
ADOConnection1: TADOConnection;
Label14: TLabel;
suiForm1: TsuiForm;
GroupBox1: TsuiGroupBox;
ComboBox1: TsuiComboBox;
Edit1: TsuiEdit;
ComboBox2: TsuiComboBox;
Edit2: TsuiEdit;
ComboBox3: TsuiComboBox;
Edit3: TsuiEdit;
Edit4: TsuiEdit;
Edit9: TsuiEdit;
GroupBox2: TsuiGroupBox;
Edit6: TsuiEdit;
Edit7: TsuiEdit;
Edit8: TsuiEdit;
memo1: TsuiMemo;
Edit5: TsuiEdit;
Edit10: TsuiEdit;
btnOk: TsuiButton;
btnCancel: TsuiButton;
BitBtn1: TsuiButton;
procedure suitempbtnOkClick(Sender: TObject);
procedure suitempbtnCancelClick(Sender: TObject);
procedure suitempBitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ckdjfrm: Tckdjfrm;
implementation
uses main;
{$R *.dfm}
procedure Tckdjfrm.suitempbtnOkClick(Sender: TObject);
var payment,quantity:string;
begin
if combobox1.Text='' then
showmessage('请选择收货单位!')
else
if combobox2.Text='' then
showmessage('请选择仓库!')
else
if combobox3.Text='' then
showmessage('请选择出库货品!')
else
if edit6.text='' then
showmessage('请输入货品数量!')
else
if edit7.Text='' then
showmessage('请输入货品单价!')
else
begin
payment:=floattostr(strtofloat(edit6.Text)*strtofloat(edit7.Text));//得到总付款数
edit10.Text:=payment;
with adoquery1 do
begin
close;
sql.Clear;
sql.Add('insert into SELL(sellid,customerid,customername,depotid,depotname,productid,productname,spec,unit,quantity,unitprice,payment,selldate,sellremark)values(');
sql.Add(''''+edit9.text+''''+','+''''+combobox1.Text+''''+','+''''+edit1.Text+''''+','+''''+combobox2.Text+''''+','+''''+edit2.Text+''''+','+''''+combobox3.Text+''''+','+''''+edit3.Text+''''+',');
sql.Add(''''+edit4.Text+''''+','+''''+edit5.Text+''''+','+''''+edit6.Text+''''+','+''''+edit7.Text+''''+','+''''+payment+''''+','+''''+edit10.text+''''+','+''''+memo1.Text+''''+')');
sql.Add('select * from SELL where depotid='+''''+combobox2.Text+''''+' and productid='+''''+combobox3.Text+'''');
open;
first;
if recordcount=0 then
begin
sql.Add('insert into STORAGE (stockid,depotid,depotname,productid,productname,spec,unit,quantity)');
sql.Add('values('+''''+edit9.text+''''+','+''''+combobox2.Text+''''+','+''''+edit2.Text+''''+','+''''+combobox3.Text+''''+',');
sql.Add(''''+edit3.Text+''''+','+''''+edit4.Text+''''+','+''''+edit5.Text+''''+','+''''+edit6.Text+''''+')');
execsql;
end
else
begin
quantity:=floattostr(strtofloat(edit6.Text)+fieldbyname('quantity').AsFloat);
sql.Add('update STORAGE set quantity='+''''+quantity+'''');
execsql;
end;
showmessage('出库登记成功!');
end;
end;
end;
procedure Tckdjfrm.suitempbtnCancelClick(Sender: TObject);
begin
close;
end;
procedure Tckdjfrm.suitempBitBtn1Click(Sender: TObject);
begin
ckdjfrm.Hide;
mainfrm.Show;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -