shangzai.txt ( File view )

  • By 2010-12-20
  • View(s):5
  • Download(s):0
  • Point(s): 1
			unit Unit31;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, DB, DBTables, DBCtrls, Grids;

type
  Tpf222 = class(TForm)
    StringGrid1: TStringGrid;
    Label2: TLabel;
    Label1: TLabel;
    CheckBox9: TCheckBox;
    CheckBox8: TCheckBox;
    CheckBox7: TCheckBox;
    CheckBox6: TCheckBox;
    CheckBox5: TCheckBox;
    CheckBox4: TCheckBox;
    CheckBox3: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox10: TCheckBox;
    CheckBox1: TCheckBox;
    Button3: TButton;
    Button2: TButton;
    Button1: TButton;
    tbname1: TMemo;
    tbname2: TMemo;
    tbname3: TMemo;
    tbname4: TMemo;
    tbname5: TMemo;
    tbname6: TMemo;
    tbname7: TMemo;
    tbname8: TMemo;
    tbname9: TMemo;
    tbname10: TMemo;
    tb1: TLabel;
    tb2: TLabel;
    tb3: TLabel;
    tb4: TLabel;
    tb5: TLabel;
    tb6: TLabel;
    tb7: TLabel;
    tb8: TLabel;
    tb9: TLabel;
    tb10: TLabel;
    Label3: TLabel;
    Button4: TButton;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    tbname: TEdit;
    zhname: TEdit;
    zhcost: TEdit;
    Button5: TButton;
    Button6: TButton;
    Button7: TButton;
    procedure FormShow(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;
      var CanSelect: Boolean);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure zhcostKeyPress(Sender: TObject; var Key: Char);
    procedure Button7Click(Sender: TObject);
  private
    {
 Private declarations 
}
    m,n,y,b,i:integer;
    t:array[1..15]of string;
    procedure gettbname;
    Procedure getzhname;
    procedure getzhdata;
    procedure getjunjia;
    procedure SettbMark;
    procedure gettbMark;
     procedure getdata;
    procedure getxiaoji;
    function ExistzhID(name:string): Boolean;
    function InsertData(Query:TQuery): Boolean;
    function UpdateData(Query: TQuery): Boolean;

    procedure Insertzh;
    procedure Updatezh;
  public
    {
 Public declarations 
}
  end;

var
  pf222: Tpf222;

implementation
uses unit30,unit9, Unit32, data, Unit1, Unit36,unit24, Unit35,Utility,unit2;
{
$R *.dfm
}


procedure Tpf222.Insertzh;
begin
  datacontrls.xm1.Close;
  datacontrls.xm1.SQL.Clear;
  datacontrls.xm1.SQL.Add('Update zhb Set zhcost =:zhcost ');
  datacontrls.xm1.SQL.Add('where xmid=:xmid and zhname= :zhname');
 with pf222 do
     begin
      if Trim(zhcost.Text) = '' then
        begin
          Application.MessageBox('请输入数据!',PChar(Application.Title),MB_ICONEXCLAMATION);
          zhcost.SetFocus;
          ModalResult := mrNone;
          Exit;
        end;
          datacontrls.xm1.ParamByName('xmid').AsInteger :=loginform.ID;
          datacontrls.xm1.ParamByName('zhname').AsString:=zhname.text;
          datacontrls.xm1.ParamByName('zhcost').AsString:=FormatFloat('###############.00',strtoFloat(t[b]));
      end;
  try
    datacontrls.xm1.ExecSQL;
  except
    datacontrls.xm1.Close;
    datacontrls.xm1.SQL.Clear;
    Exit;
  end;
  datacontrls.xm1.Close;
  datacontrls.xm1.SQL.Clear;
end;

procedure Tpf222.Updatezh;
begin
  datacontrls.xm1.Close;
  datacontrls.xm1.SQL.Clear;
  datacontrls.xm1.SQL.Add('Update zhb Set zhcost =:zhcost ');
  datacontrls.xm1.SQL.Add('where xmid=:xmid and zhname= :zhname');
 with pf222 do
     begin
      if Trim(zhcost.Text) = '' then
        begin
          Application.MessageBox('请输入数据!',PChar(Application.Title),MB_ICONEXCLAMATION);
          zhcost.SetFocus;
          ModalResult := mrNone;
          Exit;
        end;
          datacontrls.xm1.ParamByName('xmid').AsInteger :=loginform.ID;
          datacontrls.xm1.ParamByName('zhname').AsString:=zhname.text;
          datacontrls.xm1.ParamByName('zhcost').AsString:=FormatFloat('###############.00',strtoFloat(zhcost.Text));
      end;
  try
    datacontrls.xm1.ExecSQL;
  except
    datacontrls.xm1.Close;
    datacontrls.xm1.SQL.Clear;
    Exit;
  end;
  datacontrls.xm1.Close;
  datacontrls.xm1.SQL.Clear;
end;



procedure Tpf222.getdata;
var
a,j,k:integer;

begin
  datacontrls.tb4.Close;
  datacontrls.tb4.SQL.Clear;
  datacontrls.tb4.SQL.Add('select * from zhdf Where xmid=:xmid and zhname=:zhname');
  datacontrls.tb4.ParamByName('xmid').AsInteger:=loginform.ID;
  datacontrls.tb4.ParamByName('zhname').AsString:=zhname.Text;
  try
    datacontrls.tb4.open;
  except
    Application.MessageBox('打开数据失败!','错误',MB_ICONERROR);
    datacontrls.tb4.Close;
    datacontrls.tb4.SQL.Clear;
  end;

begin
  if datacontrls.tb4.RecordCount=stringgrid1.ColCount-1 then
  begin
    t[b]:=stringgrid1.Cells[1,y-3];
    for a:=2 to stringgrid1.ColCount-1 do
      begin
        if t[b]>stringgrid1.Cells[a,y-3] then
        begin
          t[b]:=stringgrid1.Cells[a,y-3];
        end;
      end;
     Insertzh;
     stringgrid1.Cells[1,y]:=t[b];
     y:=y+6;
     b:=b+1;
     stringgrid1.Cells[1,i]:='0.00';
     for j:=1 to stringgrid1.ColCount-1 do
       begin
       try
         stringgrid1.Cells[1,i]:=formatfloat('###############.00',strtofloat(stringgrid1.Cells[j,i-1])+strtofloat(stringgrid1.Cells[1,i]));
         except
       on EconvertError do stringgrid1.Cells[1,i]:='0';
       end;
       end;
     stringgrid1.Cells[1,i]:=FormatFloat('###############.00',strtoFloat(stringgrid1.Cells[1,i])/(stringgrid1.ColCount-1));

     for k:=1 to stringgrid1.ColCount-1 do
         begin
         try
           stringgrid1.Cells[k,i+1]:=FormatFloat('###############.00',(strtofloat(stringgrid1.Cells[k,i-1])-strtofloat(stringgrid1.Cells[1,i]))/strtofloat(stringgrid1.Cells[1,i])*100);
           stringgrid1.Cells[k,i+3]:=FormatFloat('###############.00',(strtofloat(stringgrid1.Cells[k,i-1])-strtofloat(stringgrid1.Cells[1,i+2]))/strtofloat(stringgrid1.Cells[1,i+2])*100);
           stringgrid1.Cells[k,i+4]:=FormatFloat('###############.00', strtofloat(xiangmu3Info.Edit3.Text)-(strtofloat(stringgrid1.Cells[k,i+3])*strtofloat(xiangmu3Info.Edit4.Text)));
           if (strtofloat(stringgrid1.Cells[k,i+4])<0) or (strtofloat(stringgrid1.Cells[k,i+4])>strtofloat(xiangmu3Info.Edit3.Text)) then
           begin
             stringgrid1.Cells[k,i+4]:=Floattostr(0.00);
           end;
         except
         on EconvertError do
           begin
             stringgrid1.Cells[k,i+1]:='0';
             stringgrid1.Cells[k,i+3]:='0';
             stringgrid1.Cells[k,i+4]:='0';
           end;
         end;
         end;
     i:=i+6;

     getxiaoji;
  end;
end;
  datacontrls.tb4.Close;
  datacontrls.tb4.SQL.Clear;
end;

procedure Tpf222.getxiaoji;
var
  j:integer;
  tb:array[1..10]of string;
begin
  datacontrls.tb4.Close;
  datacontrls.tb4.SQL.Clear;
  datacontrls.tb4.SQL.Add('select * from zhdf Where xmid=:xmid and tbname=:tbname');
  datacontrls.tb4.ParamByName('xmid').AsInteger:=loginform.ID;
  datacontrls.tb4.ParamByName('tbname').AsString:=tbname.Text;
  try
    datacontrls.tb4.open;
  except
    Application.MessageBox('打开数据失败!','错误',MB_ICONERROR);
    datacontrls.tb4.Close;
    datacontrls.tb4.SQL.Clear;
  end;

begin
  if datacontrls.tb4.RecordCount=(stringgrid1.RowCount-1)/6 then
  begin
    i:=6;
    for j:=1 to stringgrid1.ColCount-1 do
    begin
      tb[j]:='0.00';
      while i<stringgrid1.RowCount do
        begin
          tb[j]:=floattostr(strtofloat(stringgrid1.Cells[j,i])+strtofloat(tb[j]));
          i:=i+6;
        end;
      i:=6;
    end;
  tb1.Caption:=tb[1];
  tb2.Caption:=tb[2];
  tb3.Caption:=tb[3];
  tb4.Caption:=tb[4];
  tb5.Caption:=tb[5];
  tb6.Caption:=tb[6];
  tb7.Caption:=tb[7];
  tb8.Caption:=tb[8];
  tb9.Caption:=tb[9];
  tb10.Caption:=tb[10]; 
end;
end;
  datacontrls.tb4.Close;
  datacontrls.tb4.SQL.Clear;
end;



procedure Tpf222.getjunjia;
var
s,j,k:integer;
begin
  s:=2;
   while s<stringgrid1.RowCount do
   begin
     stringgrid1.Cells[1,s]:='0.00';
     for j:=1 to stringgrid1.ColCount-1 do
       begin
       try
         stringgrid1.Cells[1,s]:=formatfloat('###############.00',strtofloat(stringgrid1.Cells[j,s-1])+strtofloat(stringgrid1.Cells[1,s]));
         except
       on EconvertError do stringgrid1.Cells[1,s]:='0';
       end;
       end;
       stringgrid1.Cells[1,s]:=FormatFloat('###############.00',strtoFloat(stringgrid1.Cells[1,s])/(stringgrid1.ColCount-1));

     for k:=1 to stringgrid1.ColCount-1 do
         begin
         try
           stringgrid1.Cells[k,s+1]:=FormatFloat('###############.00',(strtofloat(stringgrid1.Cells[k,s-1])-strtofloat(stringgrid1.Cells[1,s]))/strtofloat(stringgrid1.Cells[1,s])*100);
           stringgrid1.Cells[k,s+3]:=FormatFloat('###############.00',(strtofloat(stringgrid1.Cells[k,s-1])-strtofloat(stringgrid1.Cells[1,s+2]))/strtofloat(stringgrid1.Cells[1,s+2])*100);
           stringgrid1.Cells[k,s+4]:=FormatFloat('###############.00', strtofloat(xiangmu3Info.Edit3.Text)-(strtofloat(stringgrid1.Cells[k,s+3])*strtofloat(xiangmu3Info.Edit4.Text)));
         if (strtofloat(stringgrid1.Cells[k,s+4])<0) or (strtofloat(stringgrid1.Cells[k,s+4])>strtofloat(xiangmu3Info.Edit3.Text)) then
           begin
             stringgrid1.Cells[k,s+4]:=Floattostr(0.00);
           end;
         except
         on EconvertError do
           begin
             stringgrid1.Cells[k,s+1]:='0';
             stringgrid1.Cells[k,s+3]:='0';
             stringgrid1.Cells[k,s+4]:='0';
           end;
         end;
         end;
     s:=s+6;
   end;
end;


procedure Tpf222.getzhdata;
var
r,j:integer;

begin
  datacontrls.tb4.Close;
  datacontrls.tb4.SQL.Clear;
  datacontrls.tb4.SQL.Add('select * from zhdf Where xmid=:xmid');
  datacontrls.tb4.ParamByName('xmid').AsInteger:=loginform.ID;
  try
    datacontrls.tb4.open;
  except
    Applic
...
...
(Not finished, please download and read the complete file)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
welcome.gif1.34 kB11-06-01|11:26
j2ee_info.gif1.33 kB31-08-04|05:07
web.config102.00 B15-04-05|21:51
index.aspx703.00 B15-04-05|23:02
about.aspx898.00 B15-04-05|23:14
shangzai.txt54.48 kB19-11-05|13:30
datagrid.aspx1.00 kB14-04-05|23:07
detele.aspx2.30 kB15-04-05|20:05
execute_reader.aspx890.00 B14-04-05|22:48
foot.inc666.00 B15-04-05|09:54
head.inc1.28 kB15-04-05|23:08
insert.aspx4.59 kB15-04-05|19:59
main.aspx2.90 kB15-04-05|23:03
default.aspx1.01 kB15-04-05|23:06
replace.aspx6.19 kB15-04-05|20:25
search.aspx6.27 kB15-04-05|20:26
sql_connection.aspx1.54 kB14-04-05|22:29
22.gif2.64 kB07-10-02|20:00
DataSet.aspx1.19 kB15-04-05|10:47
Edit.aspx1.93 kB15-04-05|11:17
BackTop.GIF59.93 kB07-10-02|20:00
44.gif18.05 kB07-10-02|20:00
b3.gif6.79 kB28-12-04|17:49
niao.gif1.06 kB28-12-04|17:49
...
Sponsored links

shangzai.txt (104.98 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D