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

📄 stock_fad.pas

📁 delphi的一个开发实例
💻 PAS
📖 第 1 页 / 共 4 页
字号:
    frm_Login_Man.Free;
end;

procedure Tfrm_Stock_Fad.FormShow(Sender: TObject);
var
    i,icount,k:integer;
    tt,yy,temppos:integer;
begin
    frm_Stock_Fad.Left:=170 * longint(Screen.Width) div 1024;
    frm_Stock_Fad.Top:=40 * longint(Screen.Height) div 768;
    frm_Stock_Fad.Width:=860;
    frm_Stock_Fad.Height:=715;
    iColcount:=StringGrid1.ColCount-1; //需要的填充数据的网络表格的列数
    StringGrid1.RowCount:=2;  StringGrid1.ColCount:=28;
    Total_Count:=StringGrid1.RowCount;
    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.ColWidths[20]:=100;
    StringGrid1.ColWidths[21]:=50;  StringGrid1.ColWidths[22]:=100; StringGrid1.ColWidths[23]:=100;
    StringGrid1.ColWidths[24]:=50;  StringGrid1.ColWidths[25]:=150; StringGrid1.ColWidths[26]:=150;
    StringGrid1.ColWidths[27]:=150;
    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[27,0]:='备注说明';

    if Public_Do='Stock_0004' then
    begin
        P_check.Visible:=False;
    end;
    //草稿单据查看
    if ((Public_Do='Business_Draft_0003') 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;
            end;
            Next;
        end;
        if Trim(ExamineMan3)<>'' then
        begin
            tempstr:=ExamineMan3;
            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
                    P3.Visible:=True;    L3.Caption:=LevelName3+':'+ss;
                    if ee3='' then
                    begin
                        L3.Caption:=LevelName3+':'+ss;
                        Flag3:=1;
                    end;
                    if ee3<>'' then
                    begin
                        L3.Caption:=LevelName3+'【已审】';
                        Flag3:=2;
                    end;
                end;
            end;
            Next;
        end;
        if Trim(ExamineMan4)<>'' then
        begin
            tempstr:=ExamineMan4;
            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
                    P4.Visible:=True; L4.Caption:=LevelName4+':'+ss;
                    if ee4='' then
                    begin
                        L4.Caption:=LevelName4+':'+ss;
                        Flag4:=1;
                    end;
                    if ee1<>'' then
                    begin
                        L4.Caption:=LevelName4+'【已审】';
                        Flag4:=2;
                    end;
                end;
            end;
            Next;
        end;
        if Trim(ExamineMan5)<>'' then
        begin
            tempstr:=ExamineMan5;
            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
                    P5.Visible:=True;  L5.Caption:=LevelName5+':'+ss;
                    if ee1='' then
                    begin
                        L5.Caption:=LevelName5+':'+ss;
                        Flag5:=1;
                    end;
                    if ee5<>'' then
                    begin
                        L5.Caption:=LevelName5+'【已审】';
                        Flag5:=2;
                    end;
                end;
            end;
            Next;
        end;

        with frm_data.ClientDataSet_Add do
        begin
            Close;
            CommandText:='';
            CommandText:='Select * from [V_Stock_Cancel_strip_View] where Receipt_No='''+List_No+'''';
            Open;
            k:=frm_data.ClientDataSet_Add.RecordCount;

            StringGrid1.RowCount:=k+1;
            //自动加载STRINGGRID的行数
            for K:=1 to StringGrid1.RowCount do
            begin
                StringGrid1.Cells[0,K]:=IntTostr(k); //表示第0列第i行的名称
            end;
            //******************
            Edit1.Text:=frm_data.ClientDataSet_Add.FieldValues['Copy_Date'];
            Edit2.Text:=frm_data.ClientDataSet_Add.FieldValues['Receipt_No'];
            Edit3.Text:=frm_data.ClientDataSet_Add.FieldValues['Contract_NO'];
            Edit4.Text:=frm_data.ClientDataSet_Add.FieldValues['Gather_Name'];
            Edit5.Text:=frm_data.ClientDataSet_Add.FieldValues['Storage_Name'];
            Edit6.Text:=frm_data.ClientDataSet_Add.FieldValues['Transactor'];
            Edit7.Text:=frm_data.ClientDataSet_Add.FieldValues['Shop_NO'];
            Edit8.Text:=frm_data.ClientDataSet_Add.FieldValues['proposer'];
            Edit9.Text:=frm_data.ClientDataSet_Add.FieldValues['Condense'];
            Edit10.Text:=frm_data.ClientDataSet_Add.FieldValues['Remark'];
            for k:=1 to k  do

            begin
                StringGrid1.Cells[1,k]:=frm_data.ClientDataSet_Add.FieldValues['Goods_NO'];//商品编号
                StringGrid1.Cells[2,k]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Name'];//商品名称
                StringGrid1.Cells[3,k]:=frm_data.ClientDataSet_Add.FieldValues['Pass_NO'];//批号
                StringGrid1.Cells[4,k]:=frm_data.ClientDataSet_Add.FieldValues['Price'];//单价
                StringGrid1.Cells[5,k]:=frm_data.ClientDataSet_Add.FieldValues['amount'];//数量
                StringGrid1.Cells[6,k]:=frm_data.ClientDataSet_Add.FieldValues['Total_Money'];//金额
                StringGrid1.Cells[7,k]:=frm_data.ClientDataSet_Add.FieldValues['agio']; //折扣
                StringGrid1.Cells[8,k]:=frm_data.ClientDataSet_Add.FieldValues['agio_price'];//折后单价
                StringGrid1.Cells[9,k]:=frm_data.ClientDataSet_Add.FieldValues['agio_money']; //折后金额
                StringGrid1.Cells[10,k]:=frm_data.ClientDataSet_Add.FieldValues['tax_rate'];//税率
                StringGrid1.Cells[11,k]:=frm_data.ClientDataSet_Add.FieldValues['tax_rate_price'];//税后单价
                StringGrid1.Cells[12,k]:=frm_data.ClientDataSet_Add.FieldValues['tax_money'];//税后金额
                StringGrid1.Cells[13,k]:=frm_data.ClientDataSet_Add.FieldValues['quality'];//质量状况
                StringGrid1.Cells[14,k]:=frm_data.ClientDataSet_Add.FieldValues['Fade_Name'];  //退货原因
                StringGrid1.Cells[15,k]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Modal'];//商品类别
                StringGrid1.Cells[16,k]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Cards'];//商品品牌
                StringGrid1.Cells[17,k]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Brand'];//商品品种
                StringGrid1.Cells[18,k]:=frm_data.ClientDataSet_Add.FieldValues['Norms_Type'];//规格型号
                StringGrid1.Cells[19,k]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Sphere'];//柱面度数
                StringGrid1.Cells[20,k]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Column'];//球面度数
                StringGrid1.Cells[21,k]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Color'];//商品颜色
                StringGrid1.Cells[22,k]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Coding'];//商品条码
                StringGrid1.Cells[23,k]:=frm_data.ClientDataSet_Add.FieldValues['Enroll_Brand'];//注册商标
                StringGrid1.Cells[24,k]:=frm_data.ClientDataSet_Add.FieldValues['Base_Monad'];//基本单位
                StringGrid1.Cells[25,k]:=frm_data.ClientDataSet_Add.FieldValues['Valid_Month']; //有效日期
                StringGrid1.Cells[26,k]:=frm_data.ClientDataSet_Add.FieldValues['Valid_Day']; //有效日期
                StringGrid1.Cells[27,k]:=frm_data.ClientDataSet_Add.FieldValues['Goods_Remark'];  //商品说明

                Next;
            end;

        end;
    end;
end;


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

procedure Tfrm_Stock_Fad.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_Stock_Fad.Cmd_DeleteClick(Sender: TObject);
var
    i:shortint;
begin
    if StringGrid1.col<>0 then
    begin
        StringGrid1.Rows[StringGrid1.Row].Clear; //删除选中行的所有列 ,用右键弹出菜单
        DeleteRow(StringGrid1.Row);
    end;
    for i:=1 to StringGrid1.RowCount do
    StringGrid1.cells[0,i]:=inttostr(i);
end;

end.

⌨️ 快捷键说明

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