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

📄 demand_fad.pas

📁 delphi的一个开发实例
💻 PAS
📖 第 1 页 / 共 4 页
字号:
                                            begin
                                                Close;
                                                CommandText:='';
                                                CommandText:='Insert into [Receipt](Receipt_NO,Receipt_Name,Copy_Date,Proposer,Condense) values ('''+Trim(Edit_Submit_quit_NO.Text)+''',''受托代销退货单'','''+Trim(Edit_Copy_Date.Text)+''','''+Trim(Edit_Proposer.Text)+''','''+Trim(Edit_Condense.Text)+''')';
                                                try
                                                    Execute;
                                                    try
                                                        for i:=1 to StringGrid1.RowCount-1 do
                                                        begin
                                                            with frm_data.ClientDataSet_Submit_quit_detail do
                                                            begin
                                                                Close;
                                                                CommandText:='';
                                                                CommandText:='insert into [Submit_quit_detail](Submit_quit_NO,Goods_NO,Submit_amount,Submit_price,Submit_money,Submit_Detail_Remark) values ('''+Trim(Edit_Submit_quit_NO.Text)+''','''+Trim(StringGrid1.Cells[1,i])+''','''+Trim(StringGrid1.Cells[3,i])+''','''+Trim(StringGrid1.Cells[4,i])+''','''+Trim(StringGrid1.Cells[5,i])+''','''+Trim(StringGrid1.Cells[6,i])+''')';
                                                                try
                                                                    Execute;
                                                                except
                                                                    Application.MessageBox('系统在保存[采购入库明细表]数据时候,服务器数据库连接错误,请重新连接,请确认!',pchar(application.Title),mb_iconwarning);
                                                                    Exit;
                                                                end;
                                                            end;
                                                        end;
                                                        Application.MessageBox('恭喜你,【受托代销退货单】保存草稿单据操作成功!请确认!',pchar(application.Title),mb_iconwarning);
                                                    except
                                                        Application.MessageBox('系统错误,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
                                                        Exit;
                                                    end;
                                                except
                                                    Application.MessageBox('系统在保存【受托代销退货单审核表】数据时候,服务器数据库连接错误,请重新连接,请确认!',pchar(application.Title),mb_iconwarning);
                                                    Exit;
                                                end;
                                            end;
                                        except
                                            Application.MessageBox('系统错误,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
                                            Exit;
                                        end;
                                    except
                                        Application.MessageBox('系统在保存【受托代销退货单】数据时候,服务器数据库连接错误,请重新连接,请确认!',pchar(application.Title),mb_iconwarning);
                                        Exit;
                                    end;
                                end;
                            except
                                Application.MessageBox('系统错误,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
                                Exit;
                            end;
                        end;
                    except
                        Application.MessageBox('服务器数据库连接错误,请重新连接,请确认!',pchar(application.Title),mb_iconwarning);
                        Exit;
                    end;
                end;
            except
                Application.MessageBox('添加操作失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
                Exit;
            end;
        end;
        
        //废弃退出
        if Public_Do_Result='03' then
        begin
            frm_data.ClientDataSet_Submit_quit_detail.Close;
            frm_data.ClientDataSet_Submit_quit_detail.Active:=False;
            frm_data.ClientDataSet_Submit_quit.Close;
            frm_data.ClientDataSet_Submit_quit.Active:=False;
            Close;
        end;
    end;
    //草稿单据操作
    if Public_Do='Demand_Fad_Business' then  //草稿单据过帐
    begin
        //草稿单据过帐
        if Public_Do_Result='01' then
        begin
            with frm_data.ClientDataSet_Submit_quit do
            begin
                Close;
                CommandText:='';
                Commandtext:='Select * from [V_Submit_quit_View] where Receipt_No='''+Trim(List_NO)+'''';
                try
                    Open;
                    Check_Flag:=frm_data.ClientDataSet_Submit_quit.FieldValues['Check_Result'];
                    if Check_Flag='0' then
                    begin
                        Application.MessageBox('单据还没有完全审核,不能过帐',pchar(application.Title),mb_iconwarning);
                        Exit;
                    end;
                    if Check_Flag='1' then
                    begin
                        with frm_data.ClientDataSet_Submit_quit do
                        begin
                            Close;
                            Commandtext:='';
                            Commandtext:='Update [Submit_quit] set Give_Name='''+Trim(Edit_Give_Name.Text)+''',Storage_NO='''+Trim(Edit_Storage_NO.Text)+''',Shop_NO='''+Trim(Edit_Shop_NO.Text)+''',Transactor='''+Trim(Edit_Transactor.Text)+''',Condense='''+Trim(Edit_Condense.Text)+''',Submit_Remark='''+Trim(Edit_Submit_Remark.Text)+''' where Submit_quit_NO='''+Trim(List_NO)+'''';
                            try
                                Execute;
                                try
                                    for i:=1 to StringGrid1.RowCount-1 do
                                    begin
                                        with frm_data.ClientDataSet_Submit_quit_detail do
                                        begin
                                            Close;
                                            CommandText:='';
                                            CommandText:='update [Submit_quit_detail] set Submit_amount='''+Trim(StringGrid1.Cells[3,i])+''',Submit_price='''+Trim(StringGrid1.Cells[4,i])+''',Submit_money='''+Trim(StringGrid1.Cells[5,i])+''',Submit_Detail_Remark='''+Trim(StringGrid1.Cells[6,i])+''' where Submit_quit_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;
                                    with frm_data.ClientDataSet_Receipt do
                                    begin
                                        Close;
                                        Commandtext:='';
                                        Commandtext:='Update [Receipt] set Flag_sign=''单据'' where Receipt_No='''+Trim(List_NO)+'''';
                                        try
                                            Execute;
                                            Application.MessageBox('【受托代销退货单】草稿单据过帐完毕!',pchar(application.Title),mb_iconwarning);
                                            {try
                                                //Stock_States_Total;

                                            except
                                                Application.MessageBox('修改[库存表]时失败,不能过帐,请确认!',pchar(application.Title),mb_iconwarning);
                                                Exit;
                                            end;}
                                        except
                                            Application.MessageBox('保存【受托代销退货审核表】时连接服务器失败,请确认!',pchar(application.Title),mb_iconwarning);
                                            Exit;
                                        end;
                                    end;
                                except
                                    Application.MessageBox('保存【受托代销退货明细】时循环失败,请确认!',pchar(application.Title),mb_iconwarning);
                                    Exit;
                                end;
                            except
                                Application.MessageBox('保存【受托代销退货单】时失败,请检查连接网络是否正常,请确认!',pchar(application.Title),mb_iconwarning);
                                Exit;
                            end;
                        end;
                    end;
                except
                    Application.MessageBox('打开【受托代销退货视图】时失败,不能过帐,请确认!',pchar(application.Title),mb_iconwarning);
                    Exit;
                end;
            end;
        end;
        //修改草稿单据
        if Public_Do_Result='02' then
        begin
            with frm_data.ClientDataSet_Submit_quit do
            begin
                Close;
                Commandtext:='';
                Commandtext:='Update [Submit_quit] set Give_Name='''+Trim(Edit_Give_Name.Text)+''',Storage_NO='''+Trim(Edit_Storage_NO.Text)+''',Shop_NO='''+Trim(Edit_Shop_NO.Text)+''',Transactor='''+Trim(Edit_Transactor.Text)+''',Condense='''+Trim(Edit_Condense.Text)+''',Submit_Remark='''+Trim(Edit_Submit_Remark.Text)+''' where Submit_quit_NO='''+Trim(List_NO)+'''';
                try
                    Execute; //修改采购入库表
                    try
                        for i:=1 to StringGrid1.RowCount-1 do
                        begin
                            with frm_data.ClientDataSet_Submit_quit_detail do
                            begin
                                Close;
                                CommandText:='';
                                CommandText:='update [Submit_quit_detail] set Submit_amount='''+Trim(StringGrid1.Cells[3,i])+''',Submit_price='''+Trim(StringGrid1.Cells[4,i])+''',Submit_money='''+Trim(StringGrid1.Cells[5,i])+''',Submit_Detail_Remark='''+Trim(StringGrid1.Cells[6,i])+''' where Submit_quit_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
            Close;
        end;
    end;
    frm_Public_Don.Free;
end;


procedure Tfrm_Demand_Fad.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
    Action:=Cafree;
end;

procedure Tfrm_Demand_Fad.FormShow(Sender: TObject);
var
    i,icount,k:integer;
    tt,yy,temppos:integer;
begin
    frm_Demand_Fad.Left:=170 * longint(Screen.Width) div 1024;
    frm_Demand_Fad.Top:=40 * longint(Screen.Height) div 768;
    frm_Demand_Fad.Height:=715;
    frm_Demand_Fad.Width:=860;
    iColcount:=StringGrid1.ColCount-1; //需要的填充数据的网络表格的列数
    StringGrid1.RowCount:=2;  StringGrid1.ColCount:=20;
    Total_Count:=StringGrid1.RowCount;
    for i:=1 to StringGrid1.RowCount-1 do
    begin
        StringGrid1.Cells[0,i]:=IntTostr(i); //表示第0列第i行
    end;
    StringGrid1.ColWidths[0]:=40;   StringGrid1.ColWidths[1]:=150;  StringGrid1.ColWidths[2]:=150;
    StringGrid1.ColWidths[3]:=100;  StringGrid1.ColWidths[4]:=100;  StringGrid1.ColWidths[5]:=150;
    StringGrid1.ColWidths[6]:=50;   StringGrid1.ColWidths[7]:=80;   StringGrid1.ColWidths[8]:=100;
    StringGrid1.ColWidths[9]:=50;   StringGrid1.ColWidths[10]:=100; StringGrid1.ColWidths[11]:=100;
    StringGrid1.ColWidths[12]:=50;  StringGrid1.ColWidths[13]:=150; StringGrid1.ColWidths[14]:=150;
    StringGrid1.ColWidths[15]:=100; StringGrid1.ColWidths[16]:=100; StringGrid1.ColWidths[17]:=150;
    StringGrid1.ColWidths[18]:=50;  StringGrid1.ColWidths[19]:=80; 
    
    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]:='商品说明';


    if Public_Do='Demand_Fad_Str' then
    begin
        P_check.Visible:=False;
    end;
    //草稿单据查看
    if ((Public_Do='Demand_Fad_Business') and (SH_Level<>0)) then
    begin
        P_check.Visible:=true;
        if Trim(ExamineMan1)<>'' then
        begin
            tempstr:=ExamineMan1;
            tt:=0;
            while pos(',',tempstr)>0 do //取得逗号的位置
            begin
                temppos:=pos(',',tempstr); //取得逗号的位置
                ss:=copy(tempstr,1,temppos-1);
                tempstr:=copy(tempstr,temppos+1,length(tempstr)-temppos);
                if ss=Handle_Man then
                begin
                    P1.Visible:=True; L1.Caption:=LevelName1+':'+ss;
                    if ee1='' then
                    begin
                        L1.Caption:=LevelName1+':'+ss;
                        Flag1:=1;
                    end;
                    if ee1<>'' then
                    begin
                        L1.Caption:=LevelName1+':';
                        Flag1:=2;
                    end;
                end;
            end;
            Next;
        end;
        if Trim(ExamineMan2)<>'' then
        begin
            tempstr:=ExamineMan2;
            tt:=0;
            while pos(',',tempstr)>0 do //取得逗号的位置
            begin
                temppos:=pos(',',tempstr); //取得逗号的位置
                ss:=copy(tempstr,1,temppos-1);
                tempstr:=copy(tempstr,temppos+1,length(tempstr)-temppos);
                if ss=Handle_Man then
                begin
                    P2.Visible:=True;  L2.Caption:=LevelName2+':'+ss;
                    if ee2='' then
                    begin
                        L2.Caption:=LevelName2+':'+ss;
                        Flag2:=1;
                    end;
                    if ee2<>'' then
                    begin
                        L2.Caption:=LevelName2+':';
                        Flag2:=2;
                    end;
                end;

⌨️ 快捷键说明

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