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

📄 storage_damage.pas

📁 delphi的一个开发实例
💻 PAS
📖 第 1 页 / 共 5 页
字号:
        end;
        //修改草稿单据
        if Public_Do_Result='02' then
        begin
            with frm_data.ClientDataSet_Add do
            begin
                Close;
                Commandtext:='';
                CommandText:='Update [report_damage] set Condense='''+Trim(Edit7.Text)+''',report_Remark='''+Trim(Edit8.Text)+''' where damage_NO='''+Trim(List_NO)+'''';
                try
                    Execute; //修改采购入库表
                    try
                        for i:=1 to Total_Count-1 do
                        begin
                            with frm_data.ClientDataSet_Add do
                            begin
                                Close;
                                CommandText:='';
                                CommandText:='update [report_damage_detail] set amount='''+Trim(StringGrid1.Cells[5,i])+''',Money='''+Trim(StringGrid1.Cells[6,i])+''',Remark='''+Trim(StringGrid1.Cells[19,i])+''' where damage_NO='''+Trim(List_NO)+''' and Goods_No='''+Trim(StringGrid1.Cells[1,i])+'''';
                                try
                                    Execute;//修改采购入库明细表
                                except
                                    Application.MessageBox('保存[库存报损明细]时连接服务器失败,请确认!',pchar(application.Title),mb_iconwarning);
                                    Exit;
                                end;
                            end;
                        end;
                    except
                        Application.MessageBox('保存[库存报损明细]时循环失败,请确认!',pchar(application.Title),mb_iconwarning);
                        Exit;
                    end;
                except
                    Application.MessageBox('保存[库存报损单]时失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
                    Exit;
                end;
            end;
        end;
        if func.Public_Do_Result='03' then  //废弃退出
        begin
            frm_data.ClientDataSet_Add.Close;
            frm_data.ClientDataSet_Add.Active:=False;
            Close;
        end;
    end;
    frm_Public_Don.Free;
end;

procedure Tfrm_Storage_damage.Cmd_StorageClick(Sender: TObject);
begin
    Check_Storage:='';Check_Storage_Result:='';
    Check_Storage:='damage_0001';
    frm_Storage_Select:=Tfrm_Storage_Select.Create(self);
    frm_Storage_Select.ShowModal;
    Edit_Storage_Name.Text:=Trim(Check_Storage_Result);
    Edit3.Text:=Trim(Check_Storage_Result_NO);
    frm_Storage_Select.Free;
end;

procedure Tfrm_Storage_damage.Cmd_ChildshopClick(Sender: TObject);
begin
    ChildShop_Str:='';
    ChildShop_Result_NO:='';
    ChildShop_Result_Name:='';
    ChildShop_Str:='damage_0001';
    frm_ChildShop_Select:=Tfrm_ChildShop_Select.Create(self);
    frm_ChildShop_Select.ShowModal;
    Edit5.Text:=ChildShop_Result_NO;
    frm_ChildShop_Select.Free;
end;

procedure Tfrm_Storage_damage.Edit1DblClick(Sender: TObject);
begin
    Edit1.Text:=ForMatDateTime('yyyy''-''mm''-''dd',now);
end;

procedure Tfrm_Storage_damage.Edit1KeyPress(Sender: TObject;
  var Key: Char);
begin
    if key=#13 then
        Edit1.Text:=ForMatDateTime('yyyy''-''mm''-''dd',now);
end;

procedure Tfrm_Storage_damage.Edit6KeyPress(Sender: TObject;
  var Key: Char);
begin
    if Key=#13 then
        Edit6.Text:=func.Handle_Man;
end;

procedure Tfrm_Storage_damage.Edit6DblClick(Sender: TObject);
begin
    Edit6.Text:=func.Handle_Man;
end;

procedure Tfrm_Storage_damage.Cmd_AddClick(Sender: TObject);
var
    i:integer;
begin
    StringGrid1.RowCount:=StringGrid1.RowCount+1;
    Total_Count:=StringGrid1.RowCount;
    for i:=1 to StringGrid1.RowCount-1 do
    begin
        StringGrid1.Cells[0,i]:=IntTostr(i); //表示第0列第i行
    end;
end;

procedure Tfrm_Storage_damage.Cmd_DeleteClick(Sender: TObject);
var
    i:integer;
begin
    if StringGrid1.RowCount=2 then
    begin
        Exit;
    end;
    StringGrid1.RowCount:=StringGrid1.RowCount-1;
    Total_Count:=StringGrid1.RowCount;//表示行数
    for i:=1 to StringGrid1.RowCount-1 do
    begin
        StringGrid1.Cells[0,i]:=IntTostr(i); //表示第0列第i行
    end;
end;

procedure Tfrm_Storage_damage.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_Storage_damage.StringGrid1DblClick(Sender: TObject);
var
    openstr:string;
    S1,s2,s3:string;
begin
    if Trim(Edit2.Text)='' then
    begin
        Application.MessageBox('操作失败,【单据编号】不能为空!',pchar(application.Title),mb_iconwarning);
        Edit2.SetFocus;
        Exit;
    end;
    if Trim(Edit4.Text)='' then
    begin
        Application.MessageBox('操作失败,【经手人】不能为空!',pchar(application.Title),mb_iconwarning);
        Edit4.SetFocus;
        Exit;
    end;
    if Trim(Edit6.Text)='' then
    begin
        Application.MessageBox('操作失败,【制单人】不能为空!',pchar(application.Title),mb_iconwarning);
        Edit5.SetFocus;
        Exit;
    end;
    //s1:='select Goods_NO,Goods_Name,Goods_Modal_No,Goods_Modal,Goods_Cards_NO,Goods_Cards,Goods_Brand_NO,';
    //S2:='Goods_Brand,Norms_Type_NO,Norms_Type,Goods_Sphere,Goods_Column,Goods_Color_NO,Goods_Color,Goods_Coding,Enroll_Brand,Factory,';
    //s3:='Goods_abbrev,Base_Monad,Whole_Monad,Valid_Month,Valid_Day,Remark from [Goods_Information]';
    //openstr:=s1+s2+s3;
    if ((PCol=1) or (PCol=2))then //表示选择的是商品编号 选择的是第一列
    begin
        Goods_Check_str:='';
        frm_Goods_Check:=Tfrm_Goods_Check.Create(self);
        frm_Goods_Check.ShowModal;
        if Goods_Check_str='damage_0001' then
        begin
            try
                with frm_data.ClientDataSet_Add do
                begin
                    Close;
                    CommandText:='';
                    CommandText:='select * from [V_Storage_Enter_View]  where Goods_No='''+Goods_No_Str+'''';
                    Open;

                    StringGrid1.Cells[0,0]:='行号';             StringGrid1.Cells[1,0]:='商品编号';      StringGrid1.Cells[2,0]:='商品名称';
                    StringGrid1.Cells[3,0]:='入库批号';         StringGrid1.Cells[4,0]:='入库单价';      StringGrid1.Cells[5,0]:='报损数量';
                    StringGrid1.Cells[6,0]:='合计金额';         StringGrid1.Cells[7,0]:='折扣';          StringGrid1.Cells[8,0]:='折后单价';
                    StringGrid1.Cells[9,0]:='折后合计';         StringGrid1.Cells[10,0]:='税率';         StringGrid1.Cells[11,0]:='含税单价';
                    StringGrid1.Cells[12,0]:='税后合计';        StringGrid1.Cells[13,0]:='质量状况';     StringGrid1.Cells[14,0]:='类别名称';
                    StringGrid1.Cells[15,0]:='品牌名称';        StringGrid1.Cells[16,0]:='品种名称';     StringGrid1.Cells[17,0]:='规格型号';
                    StringGrid1.Cells[18,0]:='球面度数';        StringGrid1.Cells[19,0]:='柱面度数';     StringGrid1.Cells[20,0]:='颜色名称';
                    StringGrid1.Cells[21,0]:='商品条玛';        StringGrid1.Cells[22,0]:='组册商品';     StringGrid1.Cells[23,0]:='生产厂家';
                    StringGrid1.Cells[24,0]:='基本单位';        StringGrid1.Cells[25,0]:='有效日期(月)'; StringGrid1.Cells[26,0]:='备注说明';
                    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[3,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Pass_NO'];//批号
                    StringGrid1.Cells[4,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['Price'];//单价
                    StringGrid1.Cells[7,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['agio'];//单价
                    StringGrid1.Cells[8,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['agio_Price'];//单价
                    StringGrid1.Cells[10,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['tax_rate'];//单价
                    StringGrid1.Cells[11,String_Col]:=frm_data.ClientDataSet_Add.FieldValues['tax_rate_Price'];//单价
                    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_Storage_damage.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

⌨️ 快捷键说明

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