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

📄 u_form_datacheck_2.pas

📁 这是一个啤酒行业的软件
💻 PAS
📖 第 1 页 / 共 2 页
字号:
       param.Clear;
       param.Add(_whichStore);
       param.Add(trim(grid1.cells[2,i].foretext));
       param.Add(trim(grid1.cells[3,i].foretext));
       param.Add(trim(grid1.cells[4,i].foretext));
       param.Add(_CheckDate);
       //param.Add('YP');
       strsql:='select sum(convert(real,productNum)) as a,sum(convert(real,bottleNum)) as b  from  Sale_newSample_Office   where  whichStore=:s1  and  ';
       strsql:=strsql+'productName=:s2 and  specification=:s3  and  UnitName=:s4  and  outStoreTime=:s5';
       grid1.Cells[15,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'a');
       grid1.Cells[16,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'b');
   end;
   {/*
      酒库当天的事故单
   */}
   for i:=4 to grid1.RowCount-2 do
   begin
       param.Clear;
       param.Add(_whichStore);
       param.Add(trim(grid1.cells[2,i].foretext));
       param.Add(trim(grid1.cells[3,i].foretext));
       param.Add(trim(grid1.cells[4,i].foretext));
       param.Add(_CheckDate);
       //param.Add('SG');
       strsql:='select sum(convert(real,productNum)) as a,sum(convert(real,bottleNum)) as b  from  Sale_newSample_Accident   where  whichStore=:s1  and  ';
       strsql:=strsql+'productName=:s2 and  specification=:s3  and  UnitName=:s4  and  outStoreTime=:s5';
       grid1.Cells[17,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'a');
       grid1.Cells[18,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'b');
   end;
   {/*
       倒箱付出
   */}
   for i:=4 to grid1.RowCount-2 do
   begin
       param.Clear;
       param.Add(_whichStore);
       param.Add(trim(grid1.cells[2,i].foretext));
       param.Add(trim(grid1.cells[3,i].foretext));
       param.Add(trim(grid1.cells[4,i].foretext));
       param.Add(_CheckDate);
       strsql:='select sum(convert(real,SIB_productNum)) as a   from  Sale_intoStore_DX_Before  where  SIB_whichStore=:s1  and  ';
       strsql:=strsql+'SIB_productName=:s2 and  SIB_specification=:s3  and  SIb_UnitName=:s4  and  SIb_intodate=:s5';
       grid1.Cells[19,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'a');
   end;
    {/*
       退库付出
   */}
   for i:=4 to grid1.RowCount-2 do
   begin
       param.Clear;
       param.Add(_whichStore);
       param.Add(trim(grid1.cells[2,i].foretext));
       param.Add(trim(grid1.cells[3,i].foretext));
       param.Add(trim(grid1.cells[4,i].foretext));
       param.Add(_CheckDate);
       strsql:='select sum(convert(real,SIT_productNum)) as a,sum(convert(real,SIT_emptyBoxNum)) as b,sum(convert(real,SIT_bottleNum)) as c  ';
       strsql:=strSql+'  from  Sale_intoStore_TK  where  SIT_whichStore=:s1  and  ';
       strsql:=strsql+'SIT_productName=:s2 and  SIT_specification=:s3  and  SIT_UnitName=:s4  and  SIT_intodate=:s5';
       grid1.Cells[20,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'a');
       grid1.Cells[21,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'b');
       grid1.Cells[22,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'c');
   end;
    {/*
       查询空箱损耗数据
   */}
   for i:=4 to grid1.RowCount-2 do
   begin
       param.Clear;
       param.Add(_whichStore);
       param.Add(_CheckDate);
       param.Add(trim(grid1.cells[2,i].foretext));
       param.Add(trim(grid1.cells[3,i].foretext));
       param.Add(trim(grid1.cells[4,i].foretext));

       strsql:='select sum(convert(real,SWE_EmptyBoxNum)) as a  ';
       strsql:=strsql+' from  sale_wasteBill_EmptyBox  where  ';
       strsql:=strsql+'SWE_whichStore=:s1  and  SWE_CheckDate=:s2 ';
       strsql:=strsql+'  and  SWE_produceName=:s3 and  SWE_Specification=:s4  ';
       strsql:=strsql+'  and  SWE_unitName=:s5 ';
       grid1.Cells[23,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'a');
   end;
    {/*
       查询瓶损耗数据
   */}
   for i:=4 to grid1.RowCount-2 do
   begin
       param.Clear;
       param.Add(_whichStore);
       param.Add(_CheckDate);
       param.Add(trim(grid1.cells[2,i].foretext));
       param.Add(trim(grid1.cells[3,i].foretext));
       param.Add(trim(grid1.cells[4,i].foretext));

       strsql:='select sum(convert(real,SW_bottleNum1)+convert(real,SW_bottleNum2)+convert(real,SW_bottleNum3)+';
       strSql:=strSql+'convert(real,SW_bottleNum4)+convert(real,SW_bottleNum5)+convert(real,SW_bottleNum6)+';
       strSql:=strsql+'convert(real,SW_bottleNum7)+convert(real,SW_bottleNum8)+convert(real,SW_bottleNum9)+';
       strSql:=strSql+'convert(real,SW_bottleNum10)+convert(real,SW_bottleNum11)+convert(real,SW_bottleNum12)) as a    ';
       strsql:=strsql+'from  sale_wasteBill  where  SW_whichStore=:s1  and  SW_CheckDate=:s2 ';
       strsql:=strsql+'  and  SW_produceName=:s3 and  SW_Specification=:s4  ';
       strsql:=strsql+'  and  SW_unitName=:s5 ';

       grid1.Cells[24,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'a');
   end;
   {/*
       计算出通过计算得到的库存数量
   */}
   for i:=4 to grid1.RowCount-2 do
    begin
        {/*
            加项
        */}
        if grid1.Cells[5,i].ForeText<>'' then
        begin
            _Col5:=strToFloat(grid1.Cells[5,i].ForeText);
        end
        else
            _Col5:=0;
        if  grid1.Cells[8,i].ForeText<>'' then
        begin
            _Col8:=strToFloat(grid1.Cells[8,i].ForeText);
        end
        else
            _Col8:=0;
        if  grid1.Cells[11,i].ForeText<>'' then
        begin
            _Col11:=strToFloat(grid1.Cells[11,i].ForeText);
        end
        else
            _Col11:=0;
        {/*
            减项
        */}
        if grid1.Cells[14,i].ForeText<>'' then
        begin
            _Col14:=strToFloat(grid1.Cells[14,i].ForeText);
        end
        else
            _Col14:=0;
        if  grid1.Cells[15,i].ForeText<>'' then
        begin
            _Col15:=strToFloat(grid1.Cells[15,i].ForeText);
        end
        else
            _Col15:=0;
        if  grid1.Cells[17,i].ForeText<>'' then
        begin
            _Col17:=strToFloat(grid1.Cells[17,i].ForeText);
        end
        else
            _Col17:=0;
        if  grid1.Cells[19,i].ForeText<>'' then
        begin
            _Col19:=strToFloat(grid1.Cells[19,i].ForeText);
        end
        else
            _Col19:=0;
        if  grid1.Cells[20,i].ForeText<>'' then
        begin
            _Col20:=strToFloat(grid1.Cells[20,i].ForeText);
        end
        else
            _Col20:=0;

        grid1.cells[25,i].ForeText:=trim(formatFloat('##0',(_col5+_COl8+_Col11-_Col14-_Col15-_Col17-_Col19-_Col20)));
   end;
   for i:=4 to grid1.RowCount-2 do
    begin
        {/*
            加项
        */}
        if grid1.Cells[6,i].ForeText<>'' then
        begin
            _Col6:=strToFloat(grid1.Cells[6,i].ForeText);
        end
        else
            _Col6:=0;
        if  grid1.Cells[9,i].ForeText<>'' then
        begin
            _Col9:=strToFloat(grid1.Cells[9,i].ForeText);
        end
        else
            _Col9:=0;
        if  grid1.Cells[12,i].ForeText<>'' then
        begin
            _Col12:=strToFloat(grid1.Cells[12,i].ForeText);
        end
        else
            _Col12:=0;
        {/*
            减项
        */}
        if grid1.Cells[21,i].ForeText<>'' then
        begin
            _Col21:=strToFloat(grid1.Cells[21,i].ForeText);
        end
        else
            _Col21:=0;


        grid1.cells[26,i].ForeText:=trim(formatFloat('##0',(_col6+_COl9+_Col12-_Col21)));
   end;
    for i:=4 to grid1.RowCount-2 do
    begin
        {/*
            加项
        */}
        if grid1.Cells[7,i].ForeText<>'' then
        begin
            _Col7:=strToFloat(grid1.Cells[7,i].ForeText);
        end
        else
            _Col7:=0;
        if  grid1.Cells[10,i].ForeText<>'' then
        begin
            _Col10:=strToFloat(grid1.Cells[10,i].ForeText);
        end
        else
            _Col10:=0;
        if  grid1.Cells[13,i].ForeText<>'' then
        begin
            _Col13:=strToFloat(grid1.Cells[13,i].ForeText);
        end
        else
            _Col13:=0;
        {/*
            减项
        */}
        if grid1.Cells[16,i].ForeText<>'' then
        begin
            _Col16:=strToFloat(grid1.Cells[16,i].ForeText);
        end
        else
            _Col16:=0;
        if  grid1.Cells[18,i].ForeText<>'' then
        begin
            _Col18:=strToFloat(grid1.Cells[18,i].ForeText);
        end
        else
            _Col18:=0;
        if  grid1.Cells[22,i].ForeText<>'' then
        begin
            _Col22:=strToFloat(grid1.Cells[22,i].ForeText);
        end
        else
            _Col22:=0;
        if  grid1.Cells[24,i].ForeText<>'' then
        begin
            _Col24:=strToFloat(grid1.Cells[24,i].ForeText);
        end
        else
            _Col24:=0;


        grid1.cells[27,i].ForeText:=trim(formatFloat('##0',(_col7+_COl10+_Col13-_Col16-_Col18-_Col22-_Col24)));
   end;
   {/*
        得到交班时输入的交班盘点库存
    */}
    for i:=4 to grid1.RowCount-2 do
    begin
        param.clear;
        param.Add(_whichStore);
        param.add(_CheckDate);
        param.Add(trim(grid1.cells[2,i].foretext));
        param.Add(trim(grid1.cells[3,i].foretext));
        param.Add(trim(grid1.cells[4,i].foretext));
        strsql:='select  sum(convert(real,SF_boxNum)) as a,sum(convert(real,SF_bottleNum)) as b, sum(convert(real,SF_EmptyBoxNum)) as c from  sale_handRealStore  ';
        strsql:=strsql+'where  SF_whichStore=:s1 and  substring(SF_CheckDate,1,10)=:s2   and  SF_produceName=:s3  ';
        strsql:=strsql+' and  SF_specification=:s4  and SF_UnitName=:s5';
        grid1.cells[28,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'a');
        grid1.cells[29,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'c');
        grid1.cells[30,i].ForeText:=_AdoNewproduce.getFieldValue(strsql,param,'b');

    end;
    {/*
        计算电脑的库存与实际盘点库存的差额
        Col31=Col25-Col28
        Col32=Col26-Col29
        Col33=Col27-Col30
    */}
   for i:=4 to grid1.RowCount-2 do
   begin
       {/*
       */}
       if  grid1.cells[25,i].foretext<>'' then
       begin
           _boxNum:=strToInt(grid1.cells[25,i].foretext);
       end
       else
           _boxNum:=0;
       if  grid1.cells[28,i].foretext<>'' then
       begin
           _boxNum1:=strToInt(grid1.cells[28,i].foretext);
       end
       else
           _boxNum1:=0;
       {/*
       */}
       if  grid1.cells[26,i].foretext<>'' then
       begin
           _EmptyboxNum:=strToInt(grid1.cells[26,i].foretext);
       end
       else
           _EmptyboxNum:=0;
       if  grid1.cells[29,i].foretext<>'' then
       begin
           _EmptyboxNum1:=strToInt(grid1.cells[29,i].foretext);
       end
       else
           _EmptyboxNum1:=0;
       ///////
       if  grid1.cells[27,i].foretext<>'' then
       begin
           _bottleNum:=strToInt(grid1.cells[27,i].foretext);
       end
       else
           _bottleNum:=0;
       if  grid1.cells[30,i].foretext<>'' then
       begin
           _bottleNum1:=strToInt(grid1.cells[30,i].foretext);
       end
       else
           _bottleNum1:=0;
       grid1.cells[31,i].ForeText:=formatFloat('##0',_boxNum-_boxNum1);
       grid1.cells[32,i].ForeText:=formatFloat('##0',_EmptyboxNum-_EmptyboxNum1);
       grid1.cells[33,i].ForeText:=formatFloat('##0',_bottleNum-_bottleNum1);

   end;
   for i:=4 to grid1.RowCount-2 do
   begin
       grid1.cells[31,i].Color:=rgb(241,222,157);
       grid1.cells[32,i].Color:=rgb(241,222,157);
       grid1.cells[33,i].Color:=rgb(241,222,157);

       if grid1.cells[31,i].ForeText<>'0' then
       begin
          grid1.cells[31,i].FontColor:=rgb(255,0,0);
       end;
       if grid1.cells[32,i].ForeText<>'0' then
       begin
          grid1.cells[32,i].FontColor:=rgb(255,0,0);
       end;
        if grid1.cells[33,i].ForeText<>'0' then
       begin
          grid1.cells[33,i].FontColor:=rgb(255,0,0);
       end;
   end;
   panel1.Caption:='数据统计、核对完毕!';
   panel1.visible:=false;
    grid1.Refresh;
end;

procedure TForm_DataCheck_2.FormShow(Sender: TObject);
var
    param:TStringList;
   strsql:string;

   _CheckDate:string;
   _PrevDate:string;

   i:integer;
begin
   param:=TStringList.Create;
   param.Clear;

   _CheckDate:=formatDateTime('yyyy-mm-dd',now);
   _prevDate:=formatDateTime('yyyy-mm-dd',strToDate(_CheckDate)-1);

   param.clear;
   param.Add(_whichStore);
   param.Add(_whichStore);
   strSql:='select  ProduceName,specification,UnitName  from  sale_Storage  Where  whichStore=:s1  UNION  ';
   strsql:=strsql+'select  SFO_ProductName,SFO_specification,SFO_UnitName  from  sale_followStore_other  Where  SFO_whichStore=:s2';
   _AdoNewproduce.BindToGrid_JK(grid1,strsql,param,2,4,3);
   grid1.RowCount:=grid1.RowCount+1;

   grid1.Refresh;
   for i:=4 to grid1.RowCount-2 do
   begin
       grid1.cells[1,i].ForeText:=inttostr(i-3);
   end;
end;

procedure TForm_DataCheck_2.ButtonExCtl1Click(Sender: TObject);
var
   param:TStringList;
   strSql:string;
begin
   param:=TStringList.Create;
   {
   }
end;

end.

⌨️ 快捷键说明

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