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

📄 uz_gtsp_rg.pas

📁 恒邦餐饮管理源码。将源码放到C:hbjdcyzy 登陆:1001/1001
💻 PAS
字号:
unit uz_gtsp_rg;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Menus, StdCtrls, ComCtrls, ExtCtrls, ToolWin, Grids,u_main, Buttons,
  ImgList;

type
  Tz_gtsp_rg = class(TForm)
    CoolBar1: TCoolBar;
    ToolBar1: TToolBar;
    bc: TToolButton;
    zq: TToolButton;
    bz: TToolButton;
    tc: TToolButton;
    MainMenu1: TMainMenu;
    MenuItem11: TMenuItem;
    MenuItem12: TMenuItem;
    MenuItem13: TMenuItem;
    MenuItem14: TMenuItem;
    MenuItem19: TMenuItem;
    MenuItem20: TMenuItem;
    MenuItem73: TMenuItem;
    MenuItem74: TMenuItem;
    MenuItem75: TMenuItem;
    MenuItem76: TMenuItem;
    zh: TToolButton;
    sg: TToolButton;
    xg: TToolButton;
    ScrollBox1: TScrollBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label23: TLabel;
    Label24: TLabel;
    Label25: TLabel;
    Label26: TLabel;
    Label27: TLabel;
    Label28: TLabel;
    StringGrid1: TStringGrid;
    StringGrid2: TStringGrid;
    Label30: TLabel;
    Label31: TLabel;
    Label32: TLabel;
    Label33: TLabel;
    Label34: TLabel;
    Label35: TLabel;
    Label37: TLabel;
    Shape1: TShape;
    Label7: TLabel;
    Shape2: TShape;
    Shape3: TShape;
    Shape4: TShape;
    Shape5: TShape;
    Shape6: TShape;
    Label8: TLabel;
    ywbh: TLabel;
    ywrq: TLabel;
    zy: TEdit;
    kj: TEdit;
    jl: TEdit;
    jsr: TEdit;
    czyh: TEdit;
    Shape7: TShape;
    Shape8: TShape;
    Shape9: TShape;
    Shape10: TShape;
    Label9: TLabel;
    Shape11: TShape;
    Image1: TImage;
    StatusBar1: TStatusBar;
    Image2: TImage;
    Label10: TLabel;
    qx: TToolButton;
    je_dx: TLabel;
    yl: TToolButton;
    dy: TToolButton;
    ImageList1: TImageList;
    C1: TMenuItem;
    N1: TMenuItem;
    N2: TMenuItem;
    N3: TMenuItem;
    N4: TMenuItem;
    S1: TMenuItem;
    P1: TMenuItem;
    N5: TMenuItem;
    E1: TMenuItem;
    xz: TToolButton;
    bj: TToolButton;
    ToolButton13: TToolButton;
    ToolButton14: TToolButton;
    ToolButton15: TToolButton;
    procedure tcClick(Sender: TObject);
    procedure StringGrid1SelectCell(Sender: TObject; Col, Row: Integer;
      var CanSelect: Boolean);
    procedure StringGrid1SetEditText(Sender: TObject; ACol, ARow: Integer;
      const Value: String);
    procedure StringGrid1TopLeftChanged(Sender: TObject);
    procedure StringGrid2TopLeftChanged(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure qxClick(Sender: TObject);
    procedure xzClick(Sender: TObject);
    procedure bjClick(Sender: TObject);
    procedure zqClick(Sender: TObject);
    procedure sgClick(Sender: TObject);
    procedure xgClick(Sender: TObject);
    procedure zhClick(Sender: TObject);
    procedure ylClick(Sender: TObject);
    procedure dyClick(Sender: TObject);
    procedure bzClick(Sender: TObject);
    procedure MenuItem76Click(Sender: TObject);
  private
    { Private declarations }
  public
    function stob(param1:string):string;
    function jestob(param1:string):string;
    { Public declarations }
  end;

var
  z_gtsp_rg: Tz_gtsp_rg;
  lr_text:string; //放入列表被选择的结果
  I_row:integer; //放当前光标所在行
  Refreshed:Boolean;

implementation

uses uz_sp_cx, uz_sp_cx_rg, uz_gtsp, uabout;

{$R *.DFM}
function Tz_gtsp_rg.stob(param1:string):string;
begin
  showmessage(param1);
  case strtoint(param1) of
    0:stob:='零';
    1:stob:='壹';
    2:stob:='贰';
    3:stob:='叁';
    4:stob:='肆';
    5:stob:='伍';
    6:stob:='陆';
    7:stob:='柒';
    8:stob:='捌';
    9:stob:='玖';
  end;
end;
function Tz_gtsp_rg.jestob(param1:string):string;
var
 s_je:string;
begin
  s_je:=param1;
  case length(s_je) of
    4:
       s_je:=stob(copy(s_je,1,1))+'元'+stob(copy(s_je,3,1))+'角'+stob(copy(s_je,4,1))+'分';
    5:
       s_je:=stob(copy(s_je,1,1))+'十'+stob(copy(s_je,2,1))+'元'+stob(copy(s_je,4,1))+'角'+stob(copy(s_je,5,1))+'分';
    6:
       s_je:=stob(copy(s_je,1,1))+'百'+stob(copy(s_je,2,1))+'十'+stob(copy(s_je,3,1))+'元'+stob(copy(s_je,5,1))+'角'+stob(copy(s_je,6,1))+'分';
    7:
       s_je:=stob(copy(s_je,1,1))+'千'+stob(copy(s_je,2,1))+'百'+stob(copy(s_je,3,1))+'十'+stob(copy(s_je,4,1))+'元'+stob(copy(s_je,6,1))+'角'+stob(copy(s_je,7,1))+'分';
    8:
       s_je:=stob(copy(s_je,1,1))+'万'+stob(copy(s_je,2,1))+'千'+stob(copy(s_je,3,1))+'百'+stob(copy(s_je,4,1))+'十'+stob(copy(s_je,5,1))+'元'+stob(copy(s_je,7,1))+'角'+stob(copy(s_je,8,1))+'分';
    9:
       s_je:=stob(copy(s_je,1,1))+'十'+stob(copy(s_je,2,1))+'万'+stob(copy(s_je,3,1))+'千'+stob(copy(s_je,4,1))+'百'+stob(copy(s_je,5,1))+'十'+stob(copy(s_je,6,1))+'元'+stob(copy(s_je,8,1))+'角'+stob(copy(s_je,9,1))+'分';
   10:
       s_je:=stob(copy(s_je,1,1))+'百'+stob(copy(s_je,2,1))+'十'+stob(copy(s_je,3,1))+'万'+stob(copy(s_je,4,1))+'千'+stob(copy(s_je,5,1))+'百'+stob(copy(s_je,6,1))+'十'+stob(copy(s_je,7,1))+'元'+stob(copy(s_je,9,1))+'角'+stob(copy(s_je,10,1))+'分';
   11:
       s_je:=stob(copy(s_je,1,1))+'千'+stob(copy(s_je,2,1))+'百'+stob(copy(s_je,3,1))+'十'+stob(copy(s_je,4,1))+'万'+stob(copy(s_je,5,1))+'千'+stob(copy(s_je,6,1))+'百'+stob(copy(s_je,7,1))+'十'+stob(copy(s_je,8,1))+'元'+stob(copy(s_je,10,1))+'角'+stob(copy(s_je,11,1))+'分';
   end;
   Result:=s_je;
end;


procedure Tz_gtsp_rg.tcClick(Sender: TObject);
begin
  close;
end;


procedure Tz_gtsp_rg.StringGrid1SelectCell(Sender: TObject; Col,
  Row: Integer; var CanSelect: Boolean);
begin
  if (col<>4) and (col<>5) then
    begin
      canselect:=false;
      exit;
    end;
  I_row:=row;
   with StringGrid1 Do
     If ((Cells[Col,Row]<>'') And ((Col=4) or (Col=5)) And Not Refreshed)
       Then   Cells[Col,Row]:=Format('%*.*f', [8, 2, strtofloat(cells[Col,Row])]);
   Refreshed:=True;
end;

procedure Tz_gtsp_rg.StringGrid1SetEditText(Sender: TObject; ACol,
  ARow: Integer; const Value: String);
begin
With StringGrid1 Do
 Begin
  If (Acol=4) or (Acol=5) Then
    try
       if Cells[Acol,Arow]<>'' then strtofloat(Cells[Acol,Arow]);

       if ((cells[4,toprow]<>'') and (cells[5,toprow]<>'')) then
         Try label1.caption:=Format('%*.*f', [8, 2, strtofloat(cells[4,toprow])*strtofloat(cells[5,toprow])]);
          Except
            Cells[ACol,ARow]:='';
            messagebox(handle,'数据转换或格式化错误!','系统提示信息',MB_OK+MB_ICONWARNING);
         End;
       if ((cells[4,toprow+1]<>'') and (cells[5,toprow+1]<>'')) then
         Try label2.caption:=Format('%*.*f', [8, 2, strtofloat(cells[4,toprow+1])*strtofloat(cells[5,toprow+1])]);
           Except
             Cells[ACol,ARow]:='';
            messagebox(handle,'数据转换或格式化错误!','系统提示信息',MB_OK+MB_ICONWARNING);
         End;
       if ((cells[4,toprow+2]<>'') and (cells[5,toprow+2]<>'')) then
         Try label3.caption:=Format('%*.*f', [8, 2, strtofloat(cells[4,toprow+2])*strtofloat(cells[5,toprow+2])]);
           Except
             Cells[ACol,ARow]:='';
            messagebox(handle,'数据转换或格式化错误!','系统提示信息',MB_OK+MB_ICONWARNING);
         End;
        if ((cells[4,toprow+3]<>'') and (cells[5,toprow+3]<>'')) then
          Try label4.caption:=Format('%*.*f', [8, 2, strtofloat(cells[4,toprow+3])*strtofloat(cells[5,toprow+3])]);
            Except
              Cells[ACol,ARow]:='';
            messagebox(handle,'数据转换或格式化错误!','系统提示信息',MB_OK+MB_ICONWARNING);
          End;

         if ((cells[4,toprow+4]<>'') and (cells[5,toprow+4]<>'')) then
           Try label5.caption:=Format('%*.*f', [8, 2, strtofloat(cells[4,toprow+4])*strtofloat(cells[5,toprow+4])]);
             Except
               Cells[ACol,ARow]:='';
            messagebox(handle,'数据转换或格式化错误!','系统提示信息',MB_OK+MB_ICONWARNING);
           End;

         if ((cells[4,toprow+5]<>'') and (cells[5,toprow+5]<>'')) then
           Try label6.caption:=Format('%*.*f', [8, 2, strtofloat(cells[4,toprow+5])*strtofloat(cells[5,toprow+5])]);
             Except
               Cells[ACol,ARow]:='';
            messagebox(handle,'数据转换或格式化错误!','系统提示信息',MB_OK+MB_ICONWARNING);
           End;
{
       d_je:=0;
       for i:=0 to 14 do
         if (cells[4,i]<>'') and  (cells[5,i]<>'') then
            d_je:=d_je+strtofloat(cells[4,i])*strtofloat(cells[5,i]);
       if d_je<>0 then
         je_dx.caption:=jestob(format('%*.*f',[8,2,d_je]));
}

     Except
        Cells[Acol,Arow]:='';
        messagebox(handle,'请输入合法的数字!','系统提示信息',MB_OK+MB_ICONWARNING);
     End;   //if then try


  End; //with
  Refreshed:=False;
end;

procedure Tz_gtsp_rg.StringGrid1TopLeftChanged(Sender: TObject);
begin
  with stringgrid1 do
    begin
      if ((cells[4,toprow]<>'') and (cells[5,toprow]<>'')) then
         Try label1.caption:=Format('%*.*f', [8, 2, strtofloat(cells[4,toprow])*strtofloat(cells[5,toprow])]);
          Except
            messagebox(handle,'数据转换或格式化错误!','系统提示信息',MB_OK+MB_ICONWARNING);
         End
        else
         label1.caption:='0';
      if ((cells[4,toprow+1]<>'') and (cells[5,toprow+1]<>'')) then
        Try label2.caption:=Format('%*.*f', [8, 2, strtofloat(cells[4,toprow+1])*strtofloat(cells[5,toprow+1])]);
         Except
            messagebox(handle,'数据转换或格式化错误!','系统提示信息',MB_OK+MB_ICONWARNING);
         End
        else
         label2.caption:='0';
      if ((cells[4,toprow+2]<>'') and (cells[5,toprow+2]<>'')) then
        Try label3.caption:=Format('%*.*f', [8, 2, strtofloat(cells[4,toprow+2])*strtofloat(cells[5,toprow+2])]);
         Except
            messagebox(handle,'数据转换或格式化错误!','系统提示信息',MB_OK+MB_ICONWARNING);
         End
        else
         label3.caption:='0';
      if ((cells[4,toprow+3]<>'') and (cells[5,toprow+3]<>'')) then
        Try label4.caption:=Format('%*.*f', [8, 2, strtofloat(cells[4,toprow+3])*strtofloat(cells[5,toprow+3])]);
         Except
            messagebox(handle,'数据转换或格式化错误!','系统提示信息',MB_OK+MB_ICONWARNING);
         End
        else
         label4.caption:='0';
       if ((cells[4,toprow+4]<>'') and (cells[5,toprow+4]<>'')) then
         Try label5.caption:=Format('%*.*f', [8, 2, strtofloat(cells[4,toprow+4])*strtofloat(cells[5,toprow+4])]);
          Except
            messagebox(handle,'数据转换或格式化错误!','系统提示信息',MB_OK+MB_ICONWARNING);
         End
        else
         label5.caption:='0';
       if ((cells[4,toprow+5]<>'') and (cells[5,toprow+5]<>'')) then
         Try label6.caption:=Format('%*.*f', [8, 2, strtofloat(cells[4,toprow+5])*strtofloat(cells[5,toprow+5])]);
          Except
            messagebox(handle,'数据转换或格式化错误!','系统提示信息',MB_OK+MB_ICONWARNING);
         End
        else
         label6.caption:='0';
   end;
  StringGrid2.toprow:=StringGrid1.TopRow;
end;
procedure Tz_gtsp_rg.StringGrid2TopLeftChanged(Sender: TObject);
begin
  StringGrid1.toprow:=StringGrid2.TopRow;
end;
procedure Tz_gtsp_rg.FormShow(Sender: TObject);
var
 s_ywbh:string;
 i,ii:integer;
begin
//初始化各输入项
  label1.caption:='0';
  label2.caption:='0';
  label3.caption:='0';
  label4.caption:='0';
  label5.caption:='0';
  label6.caption:='0';
  ywrq.caption:=DateToStr(Date());
  zy.text:='';
  kj.text:='';
  jl.text:='';
  jsr.text:='';
  for i:=0 to 14 do
    begin
      for ii:=0 to 5 do
         StringGrid1.cells[ii,i]:='';
      for ii:=0 to 1 do
         StringGrid2.cells[ii,i]:='';
    end;

//生成新的业务编号
  z_gtsp.gtsp.active:=false;
  z_gtsp.gtsp.active:=true;
  if z_gtsp.gtsp.recordcount=0  then
     s_ywbh:='001'
   else
    begin
     z_gtsp.gtsp.last;
     if length(z_gtsp.gtspywbh.asstring)<>14 then
        s_ywbh:='001'
       else
        begin
         s_ywbh:=copy(z_gtsp.gtspywbh.asstring,12,3);
         s_ywbh:=inttostr(strtoint(s_ywbh));
         case length(s_ywbh) of
           1:s_ywbh:='00'+inttostr(strtoint(s_ywbh)+1);
           2:s_ywbh:='0'+inttostr(strtoint(s_ywbh)+1);
           3:s_ywbh:=inttostr(strtoint(s_ywbh)+1);
          end;
          if length(s_ywbh)=4 then  s_ywbh:=copy(s_ywbh,2,3);
            //如果超过4位....
        end;
    end;

  s_ywbh:=FormatDateTime('yyyymmdd',date())+s_fdbh+s_gtbh+s_ywbh;
  ywbh.caption:=s_ywbh;
  czyh.text:=s_czyh;
end;

procedure Tz_gtsp_rg.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if (key=#13) or (key=#40) then selectnext(activecontrol,true,true);
end;

procedure Tz_gtsp_rg.qxClick(Sender: TObject);
var
 i,ii:integer;
begin
  label1.caption:='0';
  label2.caption:='0';
  label3.caption:='0';
  label4.caption:='0';
  label5.caption:='0';
  label6.caption:='0';
  ywrq.caption:=DateToStr(Date());
  zy.text:='';
  kj.text:='';
  jl.text:='';
  jsr.text:='';
  for i:=0 to 14 do
    begin
      for ii:=0 to 5 do
         StringGrid1.cells[ii,i]:='';
      for ii:=0 to 1 do
         StringGrid2.cells[ii,i]:='';
    end;

end;



procedure Tz_gtsp_rg.xzClick(Sender: TObject);
begin
//
end;

procedure Tz_gtsp_rg.bjClick(Sender: TObject);
begin
//
end;

procedure Tz_gtsp_rg.zqClick(Sender: TObject);
begin
//
end;

procedure Tz_gtsp_rg.sgClick(Sender: TObject);
begin
//
end;

procedure Tz_gtsp_rg.xgClick(Sender: TObject);
begin
//
end;

procedure Tz_gtsp_rg.zhClick(Sender: TObject);
begin
//
end;

procedure Tz_gtsp_rg.ylClick(Sender: TObject);
begin
//
end;

procedure Tz_gtsp_rg.dyClick(Sender: TObject);
begin
//
end;

procedure Tz_gtsp_rg.bzClick(Sender: TObject);
begin
//
end;

procedure Tz_gtsp_rg.MenuItem76Click(Sender: TObject);
begin
 if about=NIL then about:=Tabout.Create(self);
 about.showmodal;
end;

end.

⌨️ 快捷键说明

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