finace.~pas

来自「一个非常好的桑拿浴管理系统」· ~PAS 代码 · 共 2,024 行 · 第 1/5 页

~PAS
2,024
字号

  with SGCSXMX do                //出租箱明细
  begin
    cells[0,0]:='箱名' ;
    cells[1,0]:='客户姓名' ;
    cells[2,0]:='金额' ;
    //cells[4,0]:='结算时间' ;

  end;

  with SGQTSF do                //师傅明细 (全体)
  begin
    cells[0,0]:='服务代号' ;
    cells[1,0]:='服务名称' ;
    cells[2,0]:='单价' ;
    cells[3,0]:='数量' ;
    cells[4,0]:='总额' ;

  end;

  with SGGRSF do                //师傅明细 (个人)已结算
  begin
    cells[0,0]:='师傅代号' ;
    cells[1,0]:='服务名称' ;
    cells[2,0]:='服务单价' ;
    cells[3,0]:='数量' ;
    cells[4,0]:='总额' ;

  end;

  with SGGRSFNO do                //师傅明细 (个人)未结算及赊帐
  begin
    cells[0,0]:='师傅代号' ;
    cells[1,0]:='服务名称' ;
    cells[2,0]:='服务单价' ;
    cells[3,0]:='数量' ;
    cells[4,0]:='总额' ;

  end;

  with SGLSMX do                //零售明细
  begin
    cells[0,0]:='商品名称' ;
    cells[1,0]:='单价' ;
    cells[2,0]:='数量' ;
    cells[3,0]:='总额' ;
    //cells[4,0]:='结算时间' ;

  end;

  with SGRTJ do                //日统计
  begin
    cells[0,0]:='结算日期' ;
    cells[1,0]:='洗浴总额' ;
    cells[2,0]:='物品总额' ;
    cells[3,0]:='服务总额' ;
    cells[4,0]:='月票总额' ;
    cells[5,0]:='合计' ;
    
  end;

  with SGSZFW do                //赊帐统计(赊帐服务)
  begin
    cells[0,0]:='服务名称' ;
    cells[1,0]:='服务单价' ;
    cells[2,0]:='数量' ;
    cells[3,0]:='总额' ;
  end;

  with SGSZWP do                //赊帐统计(赊帐物品)
  begin
    cells[0,0]:='物品名称' ;
    cells[1,0]:='物品单价' ;
    cells[2,0]:='数量' ;
    cells[3,0]:='总额' ;
  end;


  with SGSZXY do                //赊帐统计(赊帐洗浴)
  begin
    cells[0,0]:='洗浴种类' ;
    cells[1,0]:='洗浴单价' ;
    cells[2,0]:='数量' ;
    cells[3,0]:='总额' ;

  end;
  with SGFLTJ do                //分类统计
  begin
    cells[0,0]:='种类' ;
    cells[1,0]:='总额' ;

  end;


end;

procedure Tfm_finace.BtnCXClick(Sender: TObject);
var
  StartDT,EndDT: Tdatetime ;  //查询开始和结束时间。
  i,k,g : integer ;
  WPheji,FWheji,LSPheji,YPheji,CZXheji,RTJheji: real;
  //Rt1,Rt2,Rt3,Rt4,Rt5,Rt6,Rt7,Rt8,Rt9,Result : real;
  FLTJheji : double; 
  j : real ;
  kaishi : Tdatetime ;
begin

  if (datetimepicker1.Checked=true) and (datetimepicker2.Checked=true) then
  begin
    StartDT:= strtodatetime(formatDatetime('yyyy-mm-dd',DateTimePicker1.date )+ ' ' +formatDatetime('hh:nn:ss',DateTimePicker3.datetime));
    EndDT:= strtodatetime(formatDatetime('yyyy-mm-dd',DateTimePicker2.date )+ ' ' +formatDatetime('hh:nn:ss',DateTimePicker4.datetime));
    if datetimepicker1.Date>datetimepicker2.Date then
    begin
      showmessage('查询开始日期不能大于查询结束日期!');
      datetimepicker1.SetFocus;
      exit;
    end;
  end
  else if (datetimepicker1.Checked=true) and (datetimepicker2.Checked=false) and (datetimepicker3.Checked=false) then
  begin
    StartDT:= strtodatetime(formatDatetime('yyyy-mm-dd',DateTimePicker1.date)+' '+ '00:00:00');
    EndDT:= strtodatetime(formatDatetime('yyyy-mm-dd',DateTimePicker1.date)+' '+ '23:59:59');

  end;
  if (datetimepicker1.Checked=true) and (datetimepicker2.Checked=true) and (datetimepicker3.Checked=false) then
  begin
    StartDT:= strtodatetime(formatDatetime('yyyy-mm-dd',DateTimePicker1.date)+' '+ '00:00:00');
    EndDT:= strtodatetime(formatDatetime('yyyy-mm-dd',DateTimePicker2.date)+' '+ '23:59:59');
  end;

  case pac_finace.TabIndex  of
    0:begin
      with aqr_sys,SGWPMX do                      //物品明细
        begin
          GRL_SGClear(SGWPMX,0,4,1,SGWPMX.RowCount-1);        //删除不加隐含列的数据  StingGrid
          Cells[2,rowcount-1]:= LabeledEdit4.Text ;

          Close;
          SQL.Clear;
                             //物品名称    单价                数量                   总额
          SQL.Add(' Select cons_name,cons_price,Sum(cons_amoun) as amount,Sum(cons_total) as total');
          SQL.Add(' From sny_consume');
          SQL.Add(' where not(cons_check_op is null)');
          SQL.Add(' And cons_arrearage = 0');
          SQL.Add(' And cons_check_time>=:StartDT ');
          SQL.Add(' And cons_check_time<=:EndDT ');
          Sql.Add(' group by cons_name,cons_price');

          Parameters.ParamByName('StartDT').Value := StartDT;
          Parameters.ParamByName('EndDT').Value := EndDT;

          Open;
          if IsEmpty then 
          begin
            Application.MessageBox('查询完毕!','提示',Mb_OK+Mb_IconInformation);
            Exit;
          end ;
          While not Eof do
          begin
            Cells[0,RowCount - 1]:= FieldByName('cons_name').AsString ;  //物品名称
            Cells[1,RowCount - 1]:= formatfloat('0.00',FieldByName('cons_price').AsFloat) ;  //单价
            Cells[2,RowCount - 1]:= FieldByName('amount').AsString ;  //数量
            Cells[3,RowCount - 1]:= formatfloat('0.00',FieldByName('total').AsFloat) ;  //总额
            //Cells[4,RowCount - 1]:= FieldByName('cons_check_time').AsString ;  //结算时间

            RowCount := RowCount + 1;
            Next;
          end ;
          //if not(recordCount = 0) then
          RowCount := RowCount - 1;

          WPheji := 0;
            for i := 1 to RowCount -1 do
            begin
              WPheji := WPheji + StrtoFloat(Cells[3,i]) ;
            end;
            LabeledEdit4.Text := FormatFloat('0.00',WPheji);

        end;
        FRM_HEJIZG ;
    end;

    1:begin
      with aqr_sys,SGFWMX do                 //服务明细
        begin
          GRL_SGClear(SGFWMX,0,4,1,SGFWMX.RowCount-1);        //删除不加隐含列的数据  StingGrid
          Cells[2,rowcount-1]:= LabeledEdit1.Text ;

          Close;
          SQL.Clear;


                          // 服务名称     单价             数量                   总额
            SQL.Add(' Select ser_name,ser_price,Count(ser_name) as amount,Sum(ser_total) as total');
            SQL.Add(' From sny_serve');
            SQL.Add(' where not(ser_end_op is null)');
            SQL.Add(' And ser_arrearage = 0');
            SQL.Add(' And ser_end_time>=:StartDT');
            SQL.Add(' And ser_end_time<=:EndDT');

            Sql.Add(' group by ser_name,ser_price');

            Parameters.ParamByName('StartDT').Value := StartDT;
            Parameters.ParamByName('EndDT').Value := EndDT;

            Open;
            if IsEmpty then 
            begin
              Application.MessageBox('查询完毕!','提示',Mb_OK+Mb_IconInformation);
              Exit;
            end;
            While not Eof do
            begin
              Cells[0,RowCount - 1]:= FieldByName('ser_name').AsString ;  //服务名称
              Cells[1,RowCount - 1]:= formatfloat('0.00',FieldByName('ser_price').AsFloat) ;  //单价
              Cells[2,RowCount - 1]:= FieldByName('amount').AsString ;  //数量
              Cells[3,RowCount - 1]:= formatfloat('0.00',FieldByName('total').AsFloat) ;  //总额
            
              RowCount := RowCount + 1;
              Next;
            end ;
            RowCount := RowCount - 1;

            FWheji := 0;
            for i := 1 to RowCount -1 do
            begin
              FWheji := FWheji + StrtoFloat(Cells[3,i]) ;
            end;
            LabeledEdit1.Text := FormatFloat('0.00',FWheji);

        end;
        FRM_HEJIZG ;
    end;

    2:begin
      with aqr_sys,SGLSP do                 //票明细 (临售票)
        begin
          GRL_SGClear(SGLSP,0,4,1,SGLSP.RowCount-1);        //删除不加隐含列的数据  StingGrid
          Cells[1,rowcount-1]:= LabeledEdit3.Text ;

          Close;
          SQL.Clear;

                          //    票种类           单价             数量                   总额
            SQL.Add(' Select reg_ticket_kind,reg_price,Count(reg_ticket_kind) as amount,Sum(reg_real_price) as total');
            SQL.Add(' From sny_reg');
            SQL.Add(' where not(reg_out_op is null)');
            SQL.Add(' And reg_arrearage = 0');
            SQL.Add(' And reg_time_out>=:StartDT');
            SQL.Add(' And reg_time_out<=:EndDT');
            Sql.Add(' group by reg_ticket_kind,reg_price');

            Parameters.ParamByName('StartDT').Value := StartDT;
            Parameters.ParamByName('EndDT').Value := EndDT;


            Open;
            if IsEmpty then 
            begin
              Application.MessageBox('查询完毕!','提示',Mb_OK+Mb_IconInformation);
              Exit;
            end;
            While not Eof do
            begin
              Cells[0,RowCount - 1]:= FieldByName('reg_ticket_kind').AsString ;  //票种类
              Cells[1,RowCount - 1]:= formatfloat('0.00',FieldByName('reg_price').AsFloat) ;  //单价
              Cells[2,RowCount - 1]:= FieldByName('amount').AsString ;  //数量
              Cells[3,RowCount - 1]:= formatfloat('0.00',FieldByName('total').AsFloat) ;  //总额


              RowCount := RowCount + 1;
              Next;
            end ;

            RowCount := RowCount - 1;

            LSPheji := 0;
            for i := 1 to RowCount -1 do
            begin
              LSPheji := LSPheji + StrtoFloat(Cells[3,i]) ;
            end;
            LabeledEdit3.Text := FormatFloat('0.00',LSPheji);

        end;

      with aqr_sys,SGYP do                 //票明细 (月票)
        begin
          GRL_SGClear(SGYP,0,4,1,SGYP.RowCount-1);        //删除不加隐含列的数据  StingGrid
          Cells[0,rowcount-1]:= LabeledEdit2.Text ;

          SQL.Clear;

                        // 月票种类       单价             数量                   总额
          SQL.Add(' Select comm_kind,comm_price,Sum(commticket_amount) as amount,Sum(commticket_price) as total');
          SQL.Add(' From sny_commticket');
          SQL.Add(' where comm_selltime>=:StartDT');
          SQL.Add(' And comm_selltime<=:EndDT');
          Sql.Add(' group by comm_kind,comm_price');


          Parameters.ParamByName('StartDT').Value := StartDT;
          Parameters.ParamByName('EndDT').Value := EndDT;

            Open;
            if IsEmpty then 
            begin
              Application.MessageBox('查询完毕!','提示',Mb_OK+Mb_IconInformation);
              Exit;
            end;
            While not Eof do
            begin
              Cells[0,RowCount - 1]:= FieldByName('comm_kind').AsString ;  //月票种类
              Cells[1,RowCount - 1]:= formatfloat('0.00',FieldByName('comm_price').AsFloat) ;  //单价
              Cells[2,RowCount - 1]:= FieldByName('amount').AsString ;  //数量
              Cells[3,RowCount - 1]:= formatfloat('0.00',FieldByName('total').AsFloat) ;  //总额

              RowCount := RowCount + 1;
              Next;
            end ;

            RowCount := RowCount - 1;

            YPheji := 0;
            for i := 1 to RowCount -1 do
            begin
              YPheji := YPheji + StrtoFloat(Cells[3,i]) ;
            end;
            LabeledEdit2.Text := FormatFloat('0.00',YPheji);


        end;
        FRM_HEJIZG ;
    end;

    3:begin
      with aqr_sys,SGCSXMX do                 //出租箱明细
        begin
          GRL_SGClear(SGCSXMX,0,3,1,SGCSXMX.RowCount-1);        //删除不加隐含列的数据  StingGrid


          Close;
          SQL.Clear;

                      //      箱名      客户姓名        金额
          SQL.Add(' Select box_lname,box_user_name,box_lprice');
          SQL.Add(' From sny_box_ldetail');
          SQL.Add(' where box_lend>=:StartDT');
          SQL.Add(' And box_lend<=:EndDT');
          Sql.Add(' group by box_lname,box_user_name,box_lprice');


          Parameters.ParamByName('StartDT').Value := StartDT;
          Parameters.ParamByName('EndDT').Value := EndDT;


          Open;
          if IsEmpty then 
          begin
            Application.MessageBox('查询完毕!','提示',Mb_OK+Mb_IconInformation);
            Exit;
          end;
          While not Eof do
          begin
            Cells[0,RowCount - 1]:= FieldByName('box_lname').AsString ;  //箱名
            Cells[1,RowCount - 1]:= FieldByName('box_user_name').AsString ;  //客户姓名
            Cells[2,RowCount - 1]:= formatfloat('0.00',FieldByName('box_lprice').AsFloat) ;  //金额


            RowCount := RowCount + 1;
            Next;
          end ;
          RowCount := RowCount - 1;
          CZXheji := 0;
            for i := 1 to RowCount -1 do
            begin
              CZXheji := CZXheji + StrtoFloat(Cells[2,i]) ;
            end;
            LabeledEdit6.Text := FormatFloat('0.00',CZXheji);


        end;
        FRM_HEJIZG ;
    end;

    4:begin
      with aqr_sys,SGQTSF do                 //师傅明细 (全体)
        begin
          GRL_SGClear(SGQTSF,0,5,1,SGQTSF.RowCount-1);        //删除不加隐含列的数据  StingGrid


          Close;
          SQL.Clear;


                      // 服务代号    服务名称  单价         数量                            总额
          SQL.Add(' Select ser_sym,ser_name,ser_price,Count(ser_name) as amount,Sum(ser_total) as total');
          SQL.Add(' From sny_serve');
          SQL.Add(' where ser_end_time>=:StartDT');
          SQL.Add(' And ser_end_time<=:EndDT');
          Sql.Add(' group by ser_sym,ser_name,ser_price');


          Parameters.ParamByName('StartDT').Value := StartDT;
          Parameters.ParamByName('EndDT').Value := EndDT;

⌨️ 快捷键说明

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