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

📄 fx_unit.pas

📁 一通进销存系统Delphi源码,进货和销售以及存多少货的管理功能
💻 PAS
📖 第 1 页 / 共 5 页
字号:
adoq1.SQL.Add('insert into kcb select 录单日期,类别,商品编码,商品名称,规格,型号,单位,sum(数量) as 库存数量,sum(金额) as 库存金额 from jhd where 录单日期 between #'+edit6.text+ '# and #' +edit7.text+'# group by 商品编码,录单日期,类别,商品名称,规格,型号,单位');
adoq1.ExecSQL ;
adoq1.SQL.Clear ;
adoq1.SQL.Add('insert into kcb select 录单日期,类别,商品编码,商品名称,规格,型号,单位,-sum(数量) as 库存数量,-sum(金额) as 库存金额 from jhthd where 录单日期 between #'+edit6.text+ '# and #' +edit7.text+'# group by 录单日期,类别,商品编码,商品名称,规格,型号,单位');
adoq1.ExecSQL ;
adoq1.SQL.Clear ;
adoq1.SQL.Add('insert into kcb select 录单日期,类别,商品编码,商品名称,规格,型号,单位,-sum(数量) as 库存数量,-sum(金额) as 库存金额 from xshd where 录单日期 between #'+edit6.text+ '# and #' +edit7.text+'# group by 录单日期,类别,商品编码,商品名称,规格,型号,单位');
adoq1.ExecSQL ;
adoq1.SQL.Clear ;
adoq1.SQL.Add('insert into kcb select 录单日期,类别,商品编码,商品名称,规格,型号,单位,sum(数量) as 库存数量,sum(金额) as 库存金额 from khthd where 录单日期 between #'+edit6.text+ '# and #' +edit7.text+'# group by 录单日期,类别,商品编码,商品名称,规格,型号,单位');
adoq1.ExecSQL ;
adoq1.SQL.Clear ;
adoq1.SQL.Add('select distinct kcb.商品编码 ,spzl.库存上限,spzl.库存下限 from kcb,spzl where kcb.商品编码 = spzl.商品编码');
adoq1.Active :=true;
if adoq1.Recordset.RecordCount >0 then
for i:=0 to adoq1.Recordset.RecordCount  do
begin
edit3.Text :=adoq1.Fields.Fields[0].AsString ;
edit4.text :=adoq1.Fields.Fields[1].AsVariant ;
edit5.text :=adoq1.Fields.Fields[2].AsVariant ;
adoq2.SQL.Clear ;
adoq2.SQL.Add('update kcb set 库存上限=:sx,库存下限=:xx where 商品编码=:bm');
adoq2.Parameters.ParamByName('bm').Value :=edit3.Text ;
adoq2.Parameters.ParamByName('sx').Value :=edit4.Text ;
adoq2.Parameters.ParamByName('xx').Value :=edit5.Text ;
adoq2.ExecSQL ;
if not adoq1.Recordset.EOF then adoq1.MoveBy(1);
end;
//else showmessage('库中没有记录!');
end;
end;
end;
//end;

procedure Tfx_form.SpeedButton1Click(Sender: TObject);
var ppp:double;
    pp:string;
    i:integer;
begin
with database do
begin
adoq1.Connection :=adoc;
adoq1.SQL.Clear ;
edit4.Text :=formatdatetime('MM-dd-yy',datetimepicker1.date);
edit5.Text :=formatdatetime('MM-dd-yy',datetimepicker2.date);
//*****************************************************************************
if radiobutton1.Checked then
begin
case combobox1.ItemIndex of
0:
  begin
         case combobox2.ItemIndex of
              0:begin
                    if checkbox1.Checked then
                      adoq1.SQL.Add('select 商品编码,sum(数量) as 总数量 from jhd  where 录单日期 between #'+edit4.text+ '# and # '+edit5.text+'# group by 商品编码')
                    else
                     adoq1.SQL.Add('select 商品编码,sum(数量) as 总数量 from jhd group by 商品编码');
                     adoq1.Active :=true;
                     chart1.Series[0].Clear ;
                      if adoq1.Recordset.RecordCount >0 then
                        begin
                             adoq1.Recordset.MoveFirst ;
                             pp:=adoq1.Fields.Fields[0].AsString ;
                             ppp:=adoq1.Fields.Fields[1].AsFloat;
                             chart1.Series[0].Add(ppp,pp,clred);
                             for i:=1 to adoq1.RecordCount-1 do
                                   begin
                                       if not adoq1.Recordset.EOF then
                                           begin
                                                 adoq1.MoveBy(1);
                                                 pp:=adoq1.Fields.Fields[0].AsString ;
                                                 ppp:=adoq1.Fields.Fields[1].AsFloat;
                                                 chart1.Series[0].Add(ppp,pp,clred);
                                            end;
                                     end;
                            end
                           else
                           showmessage('没有相关记录,请重新选择!');
                    end;    //combobox2.0结束
                1:begin
                    if checkbox1.Checked then
                      adoq1.SQL.Add('select 商品编码,sum(金额) as 总金额 from jhd  where 录单日期 between #'+edit4.text+ '# and # '+edit5.text+'# group by 商品编码')
                    else
                     adoq1.SQL.Add('select 商品编码,sum(金额) as 总金额 from jhd group by 商品编码');
                     adoq1.Active :=true;
                     chart1.Series[0].Clear ;
                      if adoq1.Recordset.RecordCount >0 then
                        begin
                             adoq1.Recordset.MoveFirst ;
                             pp:=adoq1.Fields.Fields[0].AsString ;
                             ppp:=adoq1.Fields.Fields[1].AsFloat;
                             chart1.Series[0].Add(ppp,pp,clred);
                             for i:=1 to adoq1.RecordCount-1 do
                                   begin
                                       if not adoq1.Recordset.EOF then
                                           begin
                                                 adoq1.MoveBy(1);
                                                 pp:=adoq1.Fields.Fields[0].AsString ;
                                                 ppp:=adoq1.Fields.Fields[1].AsFloat;
                                                 chart1.Series[0].Add(ppp,pp,clred);
                                            end;
                                     end;
                            end
                           else
                           showmessage('没有相关记录,请重新选择!');
                    end;    //combobox2.1结束
               end;        //combobox2case结束
        end;  //combobox1(0)结束
  1:
  begin
         case combobox2.ItemIndex of
              0:begin
                    if checkbox1.Checked then
                      adoq1.SQL.Add('select 商品名称,sum(数量) as 总数量 from jhd  where 录单日期 between #'+edit4.text+ '# and # '+edit5.text+'# group by 商品名称')
                    else
                     adoq1.SQL.Add('select 商品名称,sum(数量) as 总数量 from jhd group by 商品名称');
                     adoq1.Active :=true;
                     chart1.Series[0].Clear ;
                      if adoq1.Recordset.RecordCount >0 then
                        begin
                             adoq1.Recordset.MoveFirst ;
                             pp:=adoq1.Fields.Fields[0].AsString ;
                             ppp:=adoq1.Fields.Fields[1].AsFloat;
                             chart1.Series[0].Add(ppp,pp,clred);
                             for i:=1 to adoq1.RecordCount-1 do
                                   begin
                                       if not adoq1.Recordset.EOF then
                                           begin
                                                 adoq1.MoveBy(1);
                                                 pp:=adoq1.Fields.Fields[0].AsString ;
                                                 ppp:=adoq1.Fields.Fields[1].AsFloat;
                                                 chart1.Series[0].Add(ppp,pp,clred);
                                            end;
                                     end;
                            end
                           else
                           showmessage('没有相关记录,请重新选择!');
                    end;    //combobox2.0结束
                1:begin
                    if checkbox1.Checked then
                      adoq1.SQL.Add('select 商品名称,sum(金额) as 总金额 from jhd  where 录单日期 between #'+edit4.text+ '# and # '+edit5.text+'# group by 商品名称')
                    else
                     adoq1.SQL.Add('select 商品名称,sum(金额) as 总金额 from jhd group by 商品名称');
                     adoq1.Active :=true;
                     chart1.Series[0].Clear ;
                      if adoq1.Recordset.RecordCount >0 then
                        begin
                             adoq1.Recordset.MoveFirst ;
                             pp:=adoq1.Fields.Fields[0].AsString ;
                             ppp:=adoq1.Fields.Fields[1].AsFloat;
                             chart1.Series[0].Add(ppp,pp,clred);
                             for i:=1 to adoq1.RecordCount-1 do
                                   begin
                                       if not adoq1.Recordset.EOF then
                                           begin
                                                 adoq1.MoveBy(1);
                                                 pp:=adoq1.Fields.Fields[0].AsString ;
                                                 ppp:=adoq1.Fields.Fields[1].AsFloat;
                                                 chart1.Series[0].Add(ppp,pp,clred);
                                            end;
                                     end;
                            end
                           else
                           showmessage('没有相关记录,请重新选择!');
                    end;    //combobox2.1结束
               end;        //combobox2case结束
        end;  //combobox1(1)结束
2:
  begin
         case combobox2.ItemIndex of
              0:begin
                    if checkbox1.Checked then
                      adoq1.SQL.Add('select 类别,sum(数量) as 总数量 from jhd  where 录单日期 between #'+edit4.text+ '# and # '+edit5.text+'# group by 类别')
                    else
                     adoq1.SQL.Add('select 类别,sum(数量) as 总数量 from jhd group by 类别');
                     adoq1.Active :=true;
                     chart1.Series[0].Clear ;
                      if adoq1.Recordset.RecordCount >0 then
                        begin
                             adoq1.Recordset.MoveFirst ;
                             pp:=adoq1.Fields.Fields[0].AsString ;
                             ppp:=adoq1.Fields.Fields[1].AsFloat;
                             chart1.Series[0].Add(ppp,pp,clred);
                             for i:=1 to adoq1.RecordCount-1 do
                                   begin
                                       if not adoq1.Recordset.EOF then
                                           begin
                                                 adoq1.MoveBy(1);
                                                 pp:=adoq1.Fields.Fields[0].AsString ;
                                                 ppp:=adoq1.Fields.Fields[1].AsFloat;
                                                 chart1.Series[0].Add(ppp,pp,clred);
                                            end;
                                     end;
                            end
                           else
                           showmessage('没有相关记录,请重新选择!');
                    end;    //combobox2.0结束
                1:begin
                    if checkbox1.Checked then
                      adoq1.SQL.Add('select 类别,sum(金额) as 总金额 from jhd  where 录单日期 between #'+edit4.text+ '# and # '+edit5.text+'# group by 类别')
                    else
                     adoq1.SQL.Add('select 类别,sum(金额) as 总金额 from jhd group by 类别');
                     adoq1.Active :=true;
                     chart1.Series[0].Clear ;
                      if adoq1.Recordset.RecordCount >0 then
                        begin
                             adoq1.Recordset.MoveFirst ;
                             pp:=adoq1.Fields.Fields[0].AsString ;
                             ppp:=adoq1.Fields.Fields[1].AsFloat;
                             chart1.Series[0].Add(ppp,pp,clred);
                             for i:=1 to adoq1.RecordCount-1 do
                                   begin
                                       if not adoq1.Recordset.EOF then
                                           begin
                                                 adoq1.MoveBy(1);
                                                 pp:=adoq1.Fields.Fields[0].AsString ;
                                                 ppp:=adoq1.Fields.Fields[1].AsFloat;
                                                 chart1.Series[0].Add(ppp,pp,clred);
                                            end;
                                     end;
                            end
                           else
                           showmessage('没有相关记录,请重新选择!');
                    end;    //combobox2.1结束
               end;        //combobox2case结束
        end;  //combobox1(2)结束
    end;   //combobox1case结束
  end;    //ridiobutton1结束
//*****************************************************************************
if radiobutton2.Checked then
begin
case combobox1.ItemIndex of
0:
  begin
         case combobox2.ItemIndex of
              0:begin
                    if checkbox1.Checked then
                      adoq1.SQL.Add('select 商品编码,sum(数量) as 总数量 from jhthd  where 录单日期 between #'+edit4.text+ '# and # '+edit5.text+'# group by 商品编码')
                    else
                     adoq1.SQL.Add('select 商品编码,sum(数量) as 总数量 from jhthd group by 商品编码');
                     adoq1.Active :=true;
                     chart1.Series[0].Clear ;
                      if adoq1.Recordset.RecordCount >0 then
                        begin

⌨️ 快捷键说明

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