对不同消费层次更新不同积分倍数

2016-08-22 10:21:44来源:http://lj1987.blog.51cto.com/167978/661366作者:klick人点击


对不同消费层次更新不同积分倍数:页面设计:界面源码:object Form1: TForm1 Left = 381 Top = 245 Width = 544 Height = 453 Caption = #20419#38144#27963#21160#28040#36153#31215#20998#35843#25972 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object lbl1: TLabel Left = 8 Top = 21 Width = 36 Height = 13 Caption = #26085#26399#65306 end object lbl2: TLabel Left = 147 Top = 19 Width = 9 Height = 13 Caption = '---' end object dbgrd1: TDBGrid Left = -4 Top = 117 Width = 538 Height = 273 DataSource = ds1 TabOrder = 0 TitleFont.Charset = DEFAULT_CHARSET TitleFont.Color = clWindowText TitleFont.Height = -11 TitleFont.Name = 'MS Sans Serif' TitleFont.Style = [] Columns = < item Expanded = False FieldName = 'DEPTID' Title.Alignment = taCenter Title.Caption = #37096#38376'ID' Visible = True end item Expanded = False FieldName = 'DEPT_NAME' Title.Alignment = taCenter Title.Caption = #37096#38376#21517#31216 Visible = True end item Expanded = False FieldName = 'JZRQ' Title.Alignment = taCenter Title.Caption = #35760#36134#26085#26399 Visible = True end item Expanded = False FieldName = 'HYID' Title.Alignment = taCenter Title.Caption = #20250#21592'ID' Visible = True end item Expanded = False FieldName = 'HYK_NO' Title.Alignment = taCenter Title.Caption = #20250#21592#21345#21495 Visible = True end item Expanded = False FieldName = 'JE' Title.Alignment = taCenter Title.Caption = #28040#36153#37329#39069 Visible = True end item Expanded = False FieldName = 'JF' Title.Alignment = taCenter Title.Caption = #26356#26032#21069#31215#20998 Visible = True end> end object dtp1: TDateTimePicker Left = 48 Top = 16 Width = 95 Height = 21 Date = 40790.704349861110000000 Time = 40790.704349861110000000 TabOrder = 1 end object dtp2: TDateTimePicker Left = 160 Top = 16 Width = 95 Height = 21 Date = 40790.704499953700000000 Time = 40790.704499953700000000 TabOrder = 2 end object cbb1: TComboBox Left = 48 Top = 56 Width = 95 Height = 21 ItemHeight = 13 ItemIndex = 0 TabOrder = 3 Text = #30334#36135 OnChange = cbb1Change Items.Strings = ( #30334#36135 #21270#22918#21697 #38047#34920#29664#23453) end object btn1: TButton Left = 170 Top = 56 Width = 85 Height = 20 Caption = #26597#35810 TabOrder = 4 OnClick = btn1Click end object grp1: TGroupBox Left = 266 Top = 1 Width = 267 Height = 117 Caption = #31867#22411 TabOrder = 5 object lbl3: TLabel Left = 8 Top = 24 Width = 24 Height = 13 Caption = #37329#39069 end object lbl4: TLabel Left = 97 Top = 23 Width = 9 Height = 13 Caption = '---' end object lbl5: TLabel Left = 8 Top = 54 Width = 24 Height = 13 Caption = #37329#39069 end object lbl6: TLabel Left = 95 Top = 53 Width = 9 Height = 13 Caption = '---' end object lbl7: TLabel Left = 7 Top = 82 Width = 24 Height = 13 Caption = #37329#39069 end object lbl8: TLabel Left = 176 Top = 6 Width = 57 Height = 13 Caption = #31215#20998#20493#25968 end object edt1: TEdit Left = 35 Top = 20 Width = 60 Height = 19 Ctl3D = False ParentCtl3D = False TabOrder = 0 end object edt2: TEdit Left = 107 Top = 20 Width = 60 Height = 19 Ctl3D = False ParentCtl3D = False TabOrder = 1 end object edt3: TEdit Left = 34 Top = 50 Width = 60 Height = 19 Ctl3D = False ParentCtl3D = False TabOrder = 2 end object edt4: TEdit Left = 106 Top = 50 Width = 60 Height = 19 Ctl3D = False ParentCtl3D = False TabOrder = 3 end object edt5: TEdit Left = 34 Top = 79 Width = 132 Height = 19 Ctl3D = False ParentCtl3D = False TabOrder = 4 end object edt6: TEdit Left = 200 Top = 18 Width = 30 Height = 19 Ctl3D = False ParentCtl3D = False TabOrder = 5 end object edt7: TEdit Left = 200 Top = 50 Width = 30 Height = 19 Ctl3D = False ParentCtl3D = False TabOrder = 6 end object edt8: TEdit Left = 200 Top = 79 Width = 30 Height = 19 Ctl3D = False ParentCtl3D = False TabOrder = 7 end end object btn2: TButton Left = 170 Top = 92 Width = 85 Height = 20 Caption = #26356#26032 TabOrder = 6 Visible = False OnClick = btn2Click end object btn3: TButton Left = 49 Top = 89 Width = 93 Height = 20 Caption = #23548#20986 Enabled = False TabOrder = 7 OnClick = btn3Click end object dbedtHYID: TDBEdit Left = 46 Top = 394 Width = 121 Height = 19 Ctl3D = False DataField = 'HYID' DataSource = ds1 ParentCtl3D = False TabOrder = 8 end object dbedtJF: TDBEdit Left = 174 Top = 394 Width = 121 Height = 19 Ctl3D = False DataField = 'JF' DataSource = ds1 ParentCtl3D = False TabOrder = 9 end object dbedtJE: TDBEdit Left = 304 Top = 394 Width = 121 Height = 19 Ctl3D = False DataField = 'JE' DataSource = ds1 ParentCtl3D = False TabOrder = 10 end object db1: TDatabase AliasName = 'BF7' Connected = True DatabaseName = 'DB' LoginPrompt = False Params.Strings = ( 'USER NAME=sa' 'PASSWORD=saoffice') SessionName = 'Default' Left = 382 Top = 110 end object qry1: TQuery DatabaseName = 'DB' SQL.Strings = ( 'declare @RQ1 datetime,@RQ2 datetime' 'select @RQ1=:RQ1' 'select @RQ2=:RQ2' '' 'SELECT B.DEPTID,B.DEPT_NAME,L.JZRQ,X.HYID,X.HYK_NO,sum(L.JE) JE,' + 'sum(L.JF) JF' ' FROM BFCRM.HYXFJL L,BFCRM.HYK_HYXX X,BFBHDD.SKTXSJLC C,BFBHDD.B' + 'M B' 'where L.HYID=X.HYID' ' and C.SKTNO=L.SKTNO' ' and C.JLBH=L.JLBH' ' and C.DEPTID=B.DEPTID' ' and L.JZRQ>=@RQ1' ' and L.JZRQ<=@RQ2' ' and (B.DEPTID like '#39'0102%'#39' or B.DEPTID like '#39'0103%'#39' or B.DEPT' + 'ID like '#39'0104%'#39' or B.DEPTID like '#39'010103%'#39')' ' group by B.DEPTID,B.DEPT_NAME,L.JZRQ,X.HYID,X.HYK_NO') Left = 414 Top = 112 ParamData = < item DataType = ftUnknown Name = 'RQ1' ParamType = ptUnknown end item DataType = ftUnknown Name = 'RQ2' ParamType = ptUnknown end> end object ds1: TDataSource DataSet = qry1 Left = 446 Top = 110 end object qry2: TQuery DatabaseName = 'DB' SQL.Strings = ( 'declare @RQ3 datetime,@RQ4 datetime' 'select @RQ3=:RQ3' 'select @RQ4=:RQ4' '' 'SELECT B.DEPTID,B.DEPT_NAME,L.JZRQ,X.HYID,X.HYK_NO,sum(L.JE) JE,' + 'sum(L.JF) JF' ' FROM BFCRM.HYXFJL L,BFCRM.HYK_HYXX X,BFBHDD.SKTXSJLC C,BFBHDD.B' + 'M B' 'where L.HYID=X.HYID' ' and C.SKTNO=L.SKTNO' ' and C.JLBH=L.JLBH' ' and C.DEPTID=B.DEPTID' ' and L.JZRQ>=@RQ3' ' and L.JZRQ<=@RQ4' ' and (B.DEPTID like '#39'010101%'#39')' ' group by B.DEPTID,B.DEPT_NAME,L.JZRQ,X.HYID,X.HYK_NO') Left = 414 Top = 160 ParamData = < item DataType = ftUnknown Name = 'RQ3' ParamType = ptUnknown end item DataType = ftUnknown Name = 'RQ4' ParamType = ptUnknown end> end object qry3: TQuery DatabaseName = 'DB' SQL.Strings = ( 'declare @RQ1 datetime,@RQ2 datetime' 'select @RQ1=:RQ1' 'select @RQ2=:RQ2' '' 'SELECT B.DEPTID,B.DEPT_NAME,L.JZRQ,X.HYID,X.HYK_NO,sum(L.JE) JE,' + 'sum(L.JF) JF' ' FROM BFCRM.HYXFJL L,BFCRM.HYK_HYXX X,BFBHDD.SKTXSJLC C,BFBHDD.B' + 'M B' 'where L.HYID=X.HYID' ' and C.SKTNO=L.SKTNO' ' and C.JLBH=L.JLBH' ' and C.DEPTID=B.DEPTID' ' and L.JZRQ>=@RQ1' ' and L.JZRQ<=@RQ2' ' and (B.DEPTID like '#39'010102%'#39' or B.DEPTID like '#39'0100104%'#39')' ' group by B.DEPTID,B.DEPT_NAME,L.JZRQ,X.HYID,X.HYK_NO') Left = 416 Top = 208 ParamData = < item DataType = ftUnknown Name = 'RQ1' ParamType = ptUnknown end item DataType = ftUnknown Name = 'RQ2' ParamType = ptUnknown end> end object qry2b: TQuery DatabaseName = 'DB' SQL.Strings = ( 'declare @JLBH int' 'select @JLBH=max(JLBH)+1 from BFCRM.HYK_JFTZJL' 'insert into BFCRM.HYK_JFTZJL(JLBH,MDID,SKTNO,XSJYBH,HYID,XSRQ,TZ' + 'JF,ZY,DJR,DJRMC,DJSJ,ZXR,ZXRMC,ZXRQ,TZJE,JF_JE)' ' values(@JLBH,0,'#39'000'#39',-99999,:HYID,:CurrRQ,:TZJF,'#39#22810#20493#31215#20998#35843#25972#39 + ',-1,'#39#31995#32479#31649#29702#21592#39',:CurrRQ,-1,'#39#33258#21160#22788#29702#39',:CurrRQ,0,0)' '' 'update BFCRM.BHZT set REC_NUM=REC_NUM+1 where TBLNAME='#39'HYK_JFTZJ' + 'L'#39 '' 'update BFCRM.HYK_JFZH set WCLJF=WCLJF+:TZJF where HYID=:HYID' '' 'update BFCRM.HYK_MDJF set WCLJF=WCLJF+:TZJF where HYID=:HYID') Left = 432 Top = 392 ParamData = < item DataType = ftUnknown Name = 'HYID' ParamType = ptUnknown end item DataType = ftUnknown Name = 'CurrRQ' ParamType = ptUnknown end item DataType = ftUnknown Name = 'TZJF' ParamType = ptUnknown end item DataType = ftUnknown Name = 'CurrRQ' ParamType = ptUnknown end item DataType = ftUnknown Name = 'CurrRQ' ParamType = ptUnknown end item DataType = ftUnknown Name = 'TZJF' ParamType = ptUnknown end item DataType = ftUnknown Name = 'HYID' ParamType = ptUnknown end item DataType = ftUnknown Name = 'TZJF' ParamType = ptUnknown end item DataType = ftUnknown Name = 'HYID' ParamType = ptUnknown end> endend更新源码如下:procedure TForm1.btn2Click(Sender: TObject);var i:string; j:Integer;begin for j:=1 to dbgrd1.Columns.Count-1 do begin dbedtJE.Text:=dbgrd1.DataSource.DataSet.Fields[5].AsString; if (StrToFloat(dbedtJE.Text)>=StrToFloat(edt1.Text)) and (StrToFloat(dbedtJE.Text)<=StrToFloat(edt2.Text)) then begin qry2b.ParamByName('HYID').AsInteger:=StrToInt(dbedtHYID.Text); qry2b.ParamByName('TZJF').AsFloat:=StrToFloat(dbedtJF.Text)*strtoint(edt6.Text); qry2b.ParamByName('CurrRQ').AsDate:=Now; qry2b.ExecSQL; end else if (StrToFloat(dbedtJE.Text)>=StrToFloat(edt3.Text)) and (StrToFloat(dbedtJE.Text)<=StrToFloat(edt4.Text)) then begin qry2b.ParamByName('HYID').AsInteger:=StrToInt(dbedtHYID.Text); qry2b.ParamByName('TZJF').AsFloat:=StrToFloat(dbedtJF.Text)*strtoint(edt7.Text); qry2b.ParamByName('CurrRQ').AsDate:=Now; qry2b.ExecSQL; end else if StrToFloat(dbedtJE.Text)>=StrToFloat(edt5.Text) then begin qry2b.ParamByName('HYID').AsInteger:=StrToInt(dbedtHYID.Text); qry2b.ParamByName('TZJF').AsFloat:=StrToFloat(dbedtJF.Text)*strtoint(edt8.Text); qry2b.ParamByName('CurrRQ').AsDate:=Now; qry2b.ExecSQL; //ShowMessage('已到此步'); end; dbgrd1.DataSource.DataSet.Next; end;end;

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台