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

📄 productinfo.pas

📁 是一款针对啤酒行业的销售进销存管理系统,包括基本的进货,销售,库存
💻 PAS
字号:
unit ProductInfo;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, ADODB, ComCtrls, StdCtrls, PicButton, ExtCtrls;

type
  TProduct = class(TForm)
    Image1: TImage;
    Label1: TLabel;
    Image2: TImage;
    Bevel1: TBevel;
    Bevel2: TBevel;
    Bevel3: TBevel;
    Label2: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    PicButton1: TPicButton;
    PicButton2: TPicButton;
    PicButton3: TPicButton;
    PicButton4: TPicButton;
    PicButton7: TPicButton;
    Edit1: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    ListView1: TListView;
    Query1: TADOQuery;
    Label3: TLabel;
    ComboBox1: TComboBox;
    Label9: TLabel;
    Edit7: TEdit;
    ComboBox2: TComboBox;
    ComboBox3: TComboBox;
    ComboBox4: TComboBox;
    procedure PicButton7Click(Sender: TObject);
    procedure Image2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ListView1DblClick(Sender: TObject);
    procedure PicButton1Click(Sender: TObject);
    procedure Edit5KeyPress(Sender: TObject; var Key: Char);
    procedure PicButton2Click(Sender: TObject);
    procedure PicButton3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Product: TProduct;
  strID:string;
implementation

{$R *.dfm}
uses common;
procedure TProduct.PicButton7Click(Sender: TObject);
begin
   close;
end;

procedure TProduct.Image2Click(Sender: TObject);
begin
   close;
end;

procedure TProduct.FormCreate(Sender: TObject);
begin
     ShowPloyForm(image1.Picture.Bitmap,handle);
     edit1.Text:=inttostr(getrscount(query1,'productTable')+1);
    ////添加计量单位到控件///
     ListView1.Columns[0].Width:=40;
     ListView1.Columns[1].Width:=60;
     ListView1.Columns[2].width:=90;
     ListView1.Columns[3].width:=50;
     ListView1.Columns[4].Width:=50;
     ListView1.Columns[5].width:=50;
     ListView1.Columns[6].width:=80;
     ListView1.Columns[7].width:=80;
     ////添加计量单位
     combobox1.Items.add('箱');
     combobox1.Items.add('瓶');
     combobox1.Items.add('个');
     combobox1.Items.add('只');
     combobox1.Items.add('桶');
     combobox1.Items.add('张');
     ////添加产品名称
     combobox2.Items.add('12度参花');
     combobox2.Items.add('11度金麦');
     combobox2.Items.add('14度黑啤');
     combobox2.Items.add('10度纯鲜纸箱');
     combobox2.Items.add('10度纯鲜塑箱');
     combobox2.Items.add('10度小麦');


     combobox2.Items.add('10度干啤');
     combobox2.Items.add('11度天湖淡爽');
     
     ////添加规格///
     combobox3.Items.add('1*24');
     combobox3.Items.add('1*12');
     combobox3.Items.add('1*8');
     combobox3.Items.add('1*20');
     combobox3.Items.add('1*10');
     ////添加容量/////
     combobox4.Items.add('630ml');
     combobox4.Items.add('500ml');
     combobox4.Items.add('350ml');
     combobox4.Items.add('585ml');

     ////添加默认值///
     combobox2.text:='12度参花';
     combobox3.Text:='1*24';
     combobox4.Text:='630ml';
     combobox1.Text:='箱';
     edit5.Text:='0';
     edit6.Text:='0';
     ////显示记录/////
     FillValueToListView(query1,'select * from productTable',0,listview1);
end;

procedure TProduct.ListView1DblClick(Sender: TObject);
var
   listitem:Tlistitem;
begin
     listitem:=listview1.Items.Add;
      edit1.Text:=listview1.Selected.SubItems.Strings[0];
      strID:=listview1.Selected.Caption;
      combobox2.Text:=listview1.Selected.SubItems.Strings[1];
      combobox3.Text:=listview1.Selected.SubItems.Strings[2];
      combobox4.Text:=listview1.Selected.SubItems.Strings[3];
      combobox1.Text:=listview1.Selected.SubItems.Strings[4];
      edit5.Text:=listview1.Selected.SubItems.Strings[5];
      edit6.Text:=listview1.Selected.SubItems.Strings[6];
      edit7.Text:=listview1.Selected.SubItems.Strings[7];
      ///edit7.Text:=listview1.Selected.SubItems.Strings[7];
end;

procedure TProduct.PicButton1Click(Sender: TObject);
var
  strSql:string;
  strInsert:string;
  PriceStock,PriceSale:string;
begin
    strSql:='SELECT * FROM  productTable  WHERE CODE="'+TRIM(EDIT1.Text)+'"';

    if edit1.text<>'' then
    begin
       if Messagedlg('确定是否存盘?',mtconfirmation,[mbyes,mbno],0)=mryes then
       begin
          if isRunSql(query1,strSql) then
          begin
             showmessage('此编号记录已经存在...');
          end
          else
             begin
                 PriceStock:=formatFloat('0.00',strToFloat(edit5.text));
                 PriceSale:=formatFloat('0.00',strToFloat(edit6.text));
                 strInsert:='Insert into  productTable(code,productName,rule,capacity,unit,price_stock,price_sale,remark) values("'+trim(edit1.Text)+'","'+trim(combobox2.Text)+'","'+trim(combobox3.text)+'","'+trim(combobox4.Text)+'","'+trim(combobox1.Text)+'",'+trim(priceStock)+','+trim(PriceSale)+',"'+trim(edit7.text)+'")';
                 runNonSql(query1,strInsert);
                 FillValueToListView(query1,'select * from productTable',0,listview1);

             end;
       end;
        edit1.Text:=inttostr(getrscount(query1,'productTable')+1);
    end
    else
       begin
           showmessage('请输入编号...');
       end;
end;

procedure TProduct.Edit5KeyPress(Sender: TObject; var Key: Char);
begin
   if key=#13 then
   begin
      edit6.SelectAll;
      edit6.SetFocus;  
   end;
end;

procedure TProduct.PicButton2Click(Sender: TObject);
var
    strUpdate:string;
    PriceStock,pricesale:string;
begin
    if messagedlg('确定是否更新?',mtconfirmation,[mbyes,mbno],0)=mryes then
    begin
       PriceStock:=formatFloat('0.00',strToFloat(edit5.text));
       PriceSale:=formatFloat('0.00',strToFloat(edit6.text));
       strUpdate:='Update productTable  set  code="'+trim(edit1.Text)+'",productName="'+trim(combobox2.Text)+'",rule="'+trim(combobox3.text)+'",capacity="'+trim(combobox4.Text)+'",unit="'+trim(combobox1.Text)+'",price_stock='+trim(PriceStock)+',price_sale='+trim(PriceSale)+',remark="'+trim(edit7.Text)+'"   where  ID='+strID;
       showmessage(strUpdate);
       RunNonSql(query1,strUpdate);
       FillValueToListView(query1,'select * from productTable',0,listview1);
    end;
     edit1.Text:=inttostr(getrscount(query1,'productTable')+1);
end;

procedure TProduct.PicButton3Click(Sender: TObject);
var
   strDelete:string;
begin
     if Messagedlg('确定是否删除?',mtconfirmation,[mbyes,mbno],0)=mryes then
     begin
        strDelete:='DELETE *  FROM  productTable  WHERE  ID='+strID;
        RunNonSql(query1,strDelete);
        FillValueToListView(query1,'select * from productTable',0,listview1);
     end;
      edit1.Text:=inttostr(getrscount(query1,'productTable')+1);
end;

end.

⌨️ 快捷键说明

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