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

📄 stock_enter.pas

📁 delphi的一个开发实例
💻 PAS
📖 第 1 页 / 共 5 页
字号:
        frm_Goods_Check:=Tfrm_Goods_Check.Create(self);
        frm_Goods_Check.ShowModal;
        if Goods_Check_str='Stock_0003' then
        begin
            try
                with frm_data.ClientDataSet_Add do
                begin
                    Close;
                    CommandText:='';
                    CommandText:='select * from [Goods_Information]  where Goods_No='''+Goods_No_Str+'''';
                    Open;
                    StringGrid1.Cells[1,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_NO'];//商品名称
                    StringGrid1.Cells[2,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Name'];//商品名称
                    StringGrid1.Cells[14,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Modal']; //类别名称
                    StringGrid1.Cells[15,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Cards']; //品牌名称
                    StringGrid1.Cells[16,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Brand']; //品种名称
                    StringGrid1.Cells[17,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Norms_Type'];//规格型号名称
                    StringGrid1.Cells[18,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Sphere'];//球面度数
                    StringGrid1.Cells[19,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Column'];//柱面度数
                    StringGrid1.Cells[20,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Color'];//颜色名称
                    StringGrid1.Cells[21,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Coding'];//商品条玛
                    StringGrid1.Cells[22,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Enroll_Brand'];//注册商标
                    StringGrid1.Cells[23,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Factory'];//生产厂家
                    StringGrid1.Cells[24,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Base_Monad'];//基本单位
                    StringGrid1.Cells[25,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Valid_Day']; //有效日期
                    StringGrid1.Cells[26,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Remark'];  //备注说明
                end;
            except
                application.MessageBox('操作失败,请检查连接网络是否正常?请确认!',pchar(application.Title),mb_iconwarning);
            end;
        end;
        frm_Goods_Check.Free;
    end;
end;


procedure Tfrm_Stock_Enter.StringGrid1DrawCell(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);
var
    s:string;
    r:TRect;
begin
    with sender as TStringGrid do
    begin
        if (GDFocused in state) then
        begin
            Pcol:=Acol;
            Prow:=ARow;
            String_Col:=ARow;
        end;
    end;
    //文字垂直居中
    with StringGrid1 do
    begin
        Canvas.FillRect(Rect);
        s:=Cells[ACol,ARow];
        r:=Rect;
        DrawText(Canvas.Handle,PChar(s),Length(s),r,DT_CENTER or DT_SINGLELINE or DT_VCENTER);
    end; 
end;

procedure Tfrm_Stock_Enter.StringGrid1SetEditText(Sender: TObject; ACol,
  ARow: Integer; const Value: String);
var
    tempstr:string;
begin
    if ((StringGrid1.Cells[4,ARow]<>'') and (StringGrid1.Cells[5,ARow]<>''))then
    begin
        StringGrid1.Cells[6,ARow]:=FloatTostr(StrToFloat(StringGrid1.Cells[4,ARow])*StrToFloat(StringGrid1.Cells[5,ARow]));
    end;
    if ((StringGrid1.Cells[4,ARow]<>'') and (StringGrid1.Cells[6,ARow]<>'') and (StringGrid1.Cells[7,ARow]<>''))then
    begin
        StringGrid1.Cells[8,ARow]:=FloatTostr(StrToFloat(StringGrid1.Cells[4,ARow])*(StrToFloat(StringGrid1.Cells[7,ARow]))/10);
        StringGrid1.Cells[9,ARow]:=FloatTostr(StrToFloat(StringGrid1.Cells[6,ARow])*(StrToFloat(StringGrid1.Cells[7,ARow]))/10);
    end;
    if ((StringGrid1.Cells[8,ARow]<>'') and (StringGrid1.Cells[9,ARow]<>'') and (StringGrid1.Cells[10,ARow]<>''))then
    begin
        StringGrid1.Cells[11,ARow]:=FloatTostr(StrToFloat(StringGrid1.Cells[8,ARow])+StrToFloat(StringGrid1.Cells[8,ARow])*(StrToFloat(StringGrid1.Cells[10,ARow]))/10);
        StringGrid1.Cells[12,ARow]:=FloatTostr(StrToFloat(StringGrid1.Cells[9,ARow])+StrToFloat(StringGrid1.Cells[9,ARow])*(StrToFloat(StringGrid1.Cells[10,ARow]))/10);
    end;
end;

procedure Tfrm_Stock_Enter.Cmd1Click(Sender: TObject);
begin
    if Flag1=1 then
    begin
        if Application.MessageBox('确定需要【审核】该单据吗?请确认!',pchar(application.Title),mb_okcancel)=idok then
        begin
            try
                with frm_data.ClientDataSet4 do
                begin
                    Close;
                    Commandtext:='';
                    Commandtext:='Update [Receipt] set Examine_Man1='''+Trim(Handle_Man)+''' where Receipt_No='''+Trim(Edit2.Text)+''' and Receipt_Name=''采购入库单''';
                    Execute;
                    L1.Caption:='';
                    L1.Caption:=LevelName1+'【已审】';
                    Flag1:=2;
                    Application.MessageBox('【审核】操作成功!请确认',Pchar(application.Title),MB_ICONwarning);
                    Cmd_Check_Filsh;
                end;
            except
                Application.MessageBox('【审核】操作失败!,请确认!',pchar(application.Title),mb_iconwarning);
                Exit;
            end;
        end;
    end
    else if Flag1=2 then
    begin
        if Application.MessageBox('确定需要【反审核】该单据吗?'+#13#10+'如果【反审核】你将使后面级别的人的【审核】作废,'+#13#10+'后面级别的人必须重新【审核】,才能够生效,请确认!',pchar(application.Title),mb_okcancel)=idok then
        begin
            try
                with frm_data.ClientDataSet4 do
                begin
                    Close;
                    Commandtext:='';
                    Commandtext:='Update [Receipt] set Examine_Man1='''',Examine_Man2='''',Examine_Man3='''',Examine_Man4='''',Examine_Man5='''' where Receipt_No='''+Trim(Edit2.Text)+''' and Receipt_Name=''采购入库单''';
                    Execute;

                    L1.Caption:=LevelName1+':'+Handle_Man;
                    L2.Caption:=LevelName2+':'+Handle_Man;
                    L3.Caption:=LevelName3+':'+Handle_Man;
                    L4.Caption:=LevelName4+':'+Handle_Man;
                    L5.Caption:=LevelName5+':'+Handle_Man;
                    Flag2:=1; Flag3:=1; Flag4:=1; Flag5:=1;
                    L1.Visible:=True;
                    Flag1:=1;
                    Application.MessageBox('【反审核】操作成功!请确认',Pchar(application.Title),MB_ICONwarning);
                    Cmd_Check_Filsh;
                end;
            except
                Application.MessageBox('【反审核】操作失败!,请确认!',pchar(application.Title),mb_iconwarning);
                Exit;
            end;
        end;
    end;
end;

procedure Tfrm_Stock_Enter.Cmd2Click(Sender: TObject);
begin
    if Flag2=1 then
    begin
        if Application.MessageBox('确定需要【审核】该单据吗?请确认!',pchar(application.Title),mb_okcancel)=idok then
        begin
            try
                with frm_data.ClientDataSet4 do
                begin
                    Close;
                    Commandtext:='';
                    Commandtext:='Update [Receipt] set Examine_Man2='''+Trim(Handle_Man)+''' where Receipt_No='''+Trim(Edit2.Text)+''' and Receipt_Name=''采购入库单''';
                    Execute;
                    L2.Caption:='';
                    L2.Caption:=LevelName2+'【已审】';
                    Flag2:=2;
                    Application.MessageBox('【审核】操作成功!请确认',Pchar(application.Title),MB_ICONwarning);
                    Cmd_Check_Filsh;
                end;
            except
                Application.MessageBox('操作失败!,请确认!',pchar(application.Title),mb_iconwarning);
                Exit;
            end;
        end;
    end
    else if Flag2=2 then
    begin
        if Application.MessageBox('确定需要【反审核】该单据吗?'+#13#10+'如果【反审核】你将使后面级别的人的【审核】作废,'+#13#10+'后面级别的人必须重新【审核】,才能够生效,请确认!',pchar(application.Title),mb_okcancel)=idok then
        begin
            try
                with frm_data.ClientDataSet4 do
                begin
                    Close;
                    Commandtext:='';
                    Commandtext:='Update [Receipt] set Examine_Man2='''',Examine_Man3='''',Examine_Man4='''',Examine_Man5='''' where Receipt_No='''+Trim(Edit2.Text)+''' and Receipt_Name=''采购入库单''';
                    Execute;
                    L2.Caption:='';
                    L2.Caption:=LevelName2+':'+Handle_Man;
                    L2.Visible:=True;
                    L3.Caption:=LevelName3+':'+Handle_Man;
                    L4.Caption:=LevelName4+':'+Handle_Man;
                    L5.Caption:=LevelName5+':'+Handle_Man;
                    Flag2:=1;Flag3:=1; Flag4:=1; Flag5:=1;
                    Application.MessageBox('【反审核】操作成功!请确认',Pchar(application.Title),MB_ICONwarning);
                    Cmd_Check_Filsh;
                end;
            except
                Application.MessageBox('操作失败!,请确认!',pchar(application.Title),mb_iconwarning);
                Exit;
            end;
        end;
    end;
end;

procedure Tfrm_Stock_Enter.Cmd3Click(Sender: TObject);
begin
    if Flag3=1 then
    begin
        if Application.MessageBox('确定需要【审核】该单据吗?请确认!',pchar(application.Title),mb_okcancel)=idok then
        begin
            try
                with frm_data.ClientDataSet4 do
                begin
                    Close;
                    Commandtext:='';
                    Commandtext:='Update [Receipt] set Examine_Man3='''+Trim(Handle_Man)+''' where Receipt_No='''+Trim(Edit2.Text)+''' and Receipt_Name=''采购入库单''';
                    Execute;
                    L3.Caption:='';
                    L3.Caption:=LevelName2+'【已审】';
                    Flag3:=2;
                    Application.MessageBox('【审核】操作成功!请确认',Pchar(application.Title),MB_ICONwarning);
                    Cmd_Check_Filsh;
                end;
            except
                Application.MessageBox('操作失败!,请确认!',pchar(application.Title),mb_iconwarning);
                Exit;
            end;
        end;
    end
    else if Flag3=2 then
    begin
        if Application.MessageBox('确定需要【反审核】该单据吗?'+#13#10+'如果【反审核】你将使后面级别的人的【审核】作废,'+#13#10+'后面级别的人必须重新【审核】,才能够生效,请确认!',pchar(application.Title),mb_okcancel)=idok then
        begin
            try
                with frm_data.ClientDataSet4 do
                begin
                    Close;
                    Commandtext:='';
                    Commandtext:='Update [Receipt] set Examine_Man3='''',Examine_Man3='''',Examine_Man4='''',Examine_Man5='''' where Receipt_No='''+Trim(Edit2.Text)+''' and Receipt_Name=''采购入库单''';
                    Execute;
                    L3.Caption:='';
                    L3.Caption:=LevelName2+':'+Handle_Man;
                    L3.Visible:=True;
                    L3.Caption:=LevelName3+':'+Handle_Man;
                    L4.Caption:=LevelName4+':'+Handle_Man;
                    L5.Caption:=LevelName5+':'+Handle_Man;
                    Flag3:=1;Flag3:=1; Flag4:=1; Flag5:=1;
                    Application.MessageBox('【反审核】操作成功!请确认',Pchar(application.Title),MB_ICONwarning);
                    Cmd_Check_Filsh;
                end;
            except
                Application.MessageBox('操作失败!,请确认!',pchar(application.Title),mb_iconwarning);
                Exit;
            end;
        end;
    end;
end;

procedure Tfrm_Stock_Enter.Cmd4Click(Sender: TObject);
begin
    if Flag4=1 then
    begin
        if Application.MessageBox('确定需要【审核】该单据吗?请确认!',pchar(application.Title),mb_okcancel)=idok then
        begin
            try

⌨️ 快捷键说明

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