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

📄 stock_enter_report.pas

📁 delphi的一个开发实例
💻 PAS
📖 第 1 页 / 共 2 页
字号:
        tempSql:=tempSql+' Goods_Name Like '+''''+'%'+ Trim(ComboBox4.Text)+'%'+''''+' and ';
    end;
    if (CheckBox5.Checked=True) and  (Trim(ComboBox5.Text)<>'') then
    begin
        tempSql:=tempSql+' Copy_Date ='+''''+ Trim(ComboBox5.Text)+''''+' and ';
    end;
    if (CheckBox6.Checked=True) and (Trim(Edit_Start.Text)<>'-  -') and (Trim(Edit_End.Text)<>'-  -') then
    begin
        tempsql:=tempsql+' Copy_Date between '''+Edit_Start.Text+''' and '''+Edit_End.Text+''''+' and ';
    end;
    tempSql:=Copy(tempSql,0,length(tempSql)-4);
    with frm_data.ClientDataSet_Stock_Jion_Search do
    begin
        Close;
        CommandText:='';
        CommandText:=tempSql;
        try
            Open;
            if frm_data.ClientDataSet_Stock_Jion_Search.RecordCount<=0 then
            begin
                Application.MessageBox('对不起系统还没有符合条件的【采购入库单】!请确认!',pchar(application.Title),mb_iconwarning);
            end;
            if frm_data.ClientDataSet_Stock_Jion_Search.RecordCount>0 then
            begin
                frm_data.DataSource_Stock_Jion_Search.DataSet:=frm_data.ClientDataSet_Stock_Jion_Search;
                frm_data.DataSource_Stock_Jion_Search.Enabled:=True;
                DBGrid1.DataSource:=frm_data.DataSource_Stock_Jion_Search;
                DBGrid1.Columns[0].Title.Caption:='录单日期';
                DBGrid1.Columns[1].Title.Caption:='商品编号';
                DBGrid1.Columns[2].Title.Caption:='商品名称';
                DBGrid1.Columns[3].Title.Caption:='店面编号';
                DBGrid1.Columns[4].Title.Caption:='店面名称';
                DBGrid1.Columns[5].Title.Caption:='仓库编号';
                DBGrid1.Columns[6].Title.Caption:='仓库名称';
                DBGrid1.Columns[7].Title.Caption:='入库数量';
                first;
            end;
            if frm_data.ClientDataSet_Stock_Jion_Search.RecordCount=0 then
            begin
                frm_data.DataSource_Stock_Jion_Search.DataSet:=frm_data.ClientDataSet_Stock_Jion_Search;
                frm_data.DataSource_Stock_Jion_Search.Enabled:=False;
            end;
        except
            Application.MessageBox('系统错误,在打开【采购入库单】数据表时出错!'+#13#10+'请检查远程服务器连接是否正常?请确认!',pchar(application.Title),mb_iconwarning);
            Exit;
        end;
    end;
end;


procedure Tfrm_Stock_Enter_Report.CheckBox7Click(Sender: TObject);
begin
    if CheckBox7.Checked=True then
    begin
        ComboBox7.Visible:=True;
        ComboBox7.Clear;
        with frm_data.ClientDataSet_Select do
        begin
            Close;
            CommandText:='';
            CommandText:='Select distinct Storage_Name from [V_Stock_Cancel_strip_View]';
            Open;
            while not eof do
            begin
                ComboBox7.Items.Add(frm_data.ClientDataSet_Select.FieldByName('Storage_Name').AsString);
                Next;
            end;
        end;
    end
    else
    begin
        ComboBox7.Visible:=false;
        ComboBox7.Clear;
    end;
end;

procedure Tfrm_Stock_Enter_Report.CheckBox9Click(Sender: TObject);
begin
    if CheckBox9.Checked=True then
    begin
        ComboBox9.Visible:=True;
        ComboBox9.Clear;
        with frm_data.ClientDataSet_Select do
        begin
            Close;
            CommandText:='';
            CommandText:='Select distinct Goods_NO from [V_Stock_Cancel_strip_View]';
            Open;
            while not eof do
            begin
                ComboBox9.Items.Add(frm_data.ClientDataSet_Select.FieldByName('Goods_NO').AsString);
                Next;
            end;
        end;
    end
    else
    begin
        ComboBox9.Visible:=false;
        ComboBox9.Clear;
    end;
end;

procedure Tfrm_Stock_Enter_Report.CheckBox8Click(Sender: TObject);
begin
    if CheckBox8.Checked=True then
    begin
        ComboBox8.Visible:=True;
        ComboBox8.Clear;
        with frm_data.ClientDataSet_Select do
        begin
            Close;
            CommandText:='';
            CommandText:='Select distinct Shop_Name from [V_Stock_Cancel_strip_View]';
            Open;
            while not eof do
            begin
                ComboBox8.Items.Add(frm_data.ClientDataSet_Select.FieldByName('Shop_Name').AsString);
                Next;
            end;
        end;
    end
    else
    begin
        ComboBox8.Visible:=false;
        ComboBox8.Clear;
    end;
end;

procedure Tfrm_Stock_Enter_Report.CheckBox10Click(Sender: TObject);
begin
    if CheckBox10.Checked=True then
    begin
        ComboBox10.Visible:=True;
        ComboBox10.Clear;
        with frm_data.ClientDataSet_Select do
        begin
            Close;
            CommandText:='';
            CommandText:='Select distinct Goods_Name from [V_Stock_Cancel_strip_View]';
            Open;
            while not eof do
            begin
                ComboBox10.Items.Add(frm_data.ClientDataSet_Select.FieldByName('Goods_Name').AsString);
                Next;
            end;
        end;
    end
    else
    begin
        ComboBox10.Visible:=false;
        ComboBox10.Clear;
    end;
end;

procedure Tfrm_Stock_Enter_Report.CheckBox11Click(Sender: TObject);
begin
    if CheckBox11.Checked=True then
    begin
        ComboBox11.Visible:=True;
        ComboBox11.Clear;
        with frm_data.ClientDataSet_Select do
        begin
            Close;
            CommandText:='';
            CommandText:='Select distinct Copy_Date from [V_Stock_Cancel_strip_View]';
            Open;
            while not eof do
            begin
                ComboBox11.Items.Add(ForMatDateTime('yyyy''-''mm''-''dd',frm_data.ClientDataSet_Select.FieldByName('Copy_Date').AsDateTime));
                Next;
            end;
        end;
    end
    else
    begin
        ComboBox11.Visible:=false;
        ComboBox11.Clear;
    end;
end;

procedure Tfrm_Stock_Enter_Report.CheckBox12Click(Sender: TObject);
begin
    if CheckBox12.Checked=True then
    begin
        Edit_Start.Visible:=True;
        Edit_End.Visible:=True;
        DP1.Visible:=true;  DP2.Visible:=true;
        Edit_End.Clear;
        Edit_Start.Clear;
    end
    else
    begin
        Edit_Start.Visible:=false;
        Edit_End.Visible:=false;
        DP1.Visible:=false;  DP2.Visible:=false;
        Edit_End.Clear;
        Edit_Start.Clear;
    end;
end;

procedure Tfrm_Stock_Enter_Report.DP3Change(Sender: TObject);
begin
    MaskEdit_Start.Text:=FormatdateTime('yyyy''-''mm''-''dd',DP3.Date);
end;

procedure Tfrm_Stock_Enter_Report.DP4Change(Sender: TObject);
begin
    MaskEdit_End.Text:=FormatdateTime('yyyy''-''mm''-''dd',DP4.Date);
end;

procedure Tfrm_Stock_Enter_Report.SpeedButton1Click(Sender: TObject);
var
    tempsql:string;
begin
    tempsql:='Select Copy_Date,Goods_No,Goods_Name,Shop_No,Shop_Name,Storage_No,Storage_Name,amount from [V_Stock_Cancel_strip_View] where ';
    if (CheckBox7.Checked=True) and  (Trim(ComboBox7.Text)<>'') then
    begin
        tempSql:=tempSql+' Storage_Name Like '+''''+'%'+ Trim(ComboBox7.Text)+'%'+''''+' and ';
    end;
    if (CheckBox8.Checked=True) and (Trim(ComboBox8.Text)<>'') then
    begin
        tempSql:=tempSql+' Shop_Name Like '+''''+'%'+ Trim(ComboBox8.Text)+'%'+''''+' and ';
    end;
    if (CheckBox9.Checked=True) and (Trim(ComboBox9.Text)<>'') then
    begin
        tempSql:=tempSql+' Goods_NO Like '+''''+'%'+ Trim(ComboBox9.Text)+'%'+''''+' and ';
    end;
    if (CheckBox10.Checked=True) and  (Trim(ComboBox10.Text)<>'') then
    begin
        tempSql:=tempSql+' Goods_Name Like '+''''+'%'+ Trim(ComboBox4.Text)+'%'+''''+' and ';
    end;
    if (CheckBox11.Checked=True) and  (Trim(ComboBox11.Text)<>'') then
    begin
        tempSql:=tempSql+' Copy_Date ='+''''+ Trim(ComboBox11.Text)+''''+' and ';
    end;
    if (CheckBox12.Checked=True) and (Trim(MaskEdit_Start.Text)<>'-  -') and (Trim(MaskEdit_End.Text)<>'-  -') then
    begin
        tempsql:=tempsql+' Copy_Date between '''+MaskEdit_Start.Text+''' and '''+MaskEdit_End.Text+''''+' and ';
    end;
    tempSql:=Copy(tempSql,0,length(tempSql)-4);
    with frm_data.ClientDataSet_Stock_Jion_Search do
    begin
        Close;
        CommandText:='';
        CommandText:=tempSql;
        try
            Open;
            if frm_data.ClientDataSet_Stock_Jion_Search.RecordCount<=0 then
            begin
                Application.MessageBox('对不起系统还没有符合条件的【采购退货】!请确认!',pchar(application.Title),mb_iconwarning);
            end;
            if frm_data.ClientDataSet_Stock_Jion_Search.RecordCount>0 then
            begin
                frm_data.DataSource_Stock_Jion_Search.DataSet:=frm_data.ClientDataSet_Stock_Jion_Search;
                frm_data.DataSource_Stock_Jion_Search.Enabled:=True;
                DBGrid2.DataSource:=frm_data.DataSource_Stock_Jion_Search;
                DBGrid2.Columns[0].Title.Caption:='录单日期';
                DBGrid2.Columns[1].Title.Caption:='商品编号';
                DBGrid2.Columns[2].Title.Caption:='商品名称';
                DBGrid2.Columns[3].Title.Caption:='店面编号';
                DBGrid2.Columns[4].Title.Caption:='店面名称';
                DBGrid2.Columns[5].Title.Caption:='仓库编号';
                DBGrid2.Columns[6].Title.Caption:='仓库名称';
                DBGrid2.Columns[7].Title.Caption:='入库数量';
                first;
            end;
            if frm_data.ClientDataSet_Stock_Jion_Search.RecordCount=0 then
            begin
                frm_data.DataSource_Stock_Jion_Search.DataSet:=frm_data.ClientDataSet_Stock_Jion_Search;
                frm_data.DataSource_Stock_Jion_Search.Enabled:=False;
            end;
        except
            Application.MessageBox('系统错误,在打开【采购退货】数据表时出错!'+#13#10+'请检查远程服务器连接是否正常?请确认!',pchar(application.Title),mb_iconwarning);
            Exit;
        end;
    end;
end;


end.

⌨️ 快捷键说明

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