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

📄 mnform.~pas

📁 一款专业的电话交换机计费管理系统
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
          formatdatetime('hh:mm:ss', qy2.fieldbyname('st_tm').asdatetime);
        qy4.ParamByName('ed_tm').asstring :=
          formatdatetime('hh:mm:ss', qy2.fieldbyname('ed_tm').asdatetime);
        qy4.ParamByName('du_tm').asinteger := trunc((qy2.fieldbyname('du_tm').asinteger + 59) / 60);
        qy4.ParamByName('tele_rt').asCurrency := qy3.fieldbyname('loc_rt').asCurrency;
        qy4.ParamByName('tele_amt').asCurrency := total;
        qy4.ParamByName('dial_num').asstring := qy2.fieldbyname('dial_num').asstring;
        qy4.ParamByName('ext_num').asstring := qy2.fieldbyname('ext_num').asstring;
        qy4.ExecSQL;
        stringgrid1.RowCount := stringgrid1.RowCount + 1;
        stringgrid1.Cells[0, stringgrid1.RowCount - 2] :=
          formatdatetime('yyyy-mm-dd', qy2.fieldbyname('tele_dt').asdatetime);
        stringgrid1.Cells[1, stringgrid1.RowCount - 2] := qy2.fieldbyname('dial_num').asstring;
        stringgrid1.Cells[2, stringgrid1.RowCount - 2] := qy2.fieldbyname('ext_num').asstring;
        stringgrid1.Cells[4, stringgrid1.RowCount - 2] := qy2.fieldbyname('st_tm').asstring;
        stringgrid1.Cells[5, stringgrid1.RowCount - 2] := qy3.fieldbyname('discrpt').asstring;
        stringgrid1.Cells[6, stringgrid1.RowCount - 2] :=
          inttostr(trunc((qy2.fieldbyname('du_tm').asinteger + 59) / 60));
        stringgrid1.Cells[7, stringgrid1.RowCount - 2] := qy3.fieldbyname('loc_rt').asstring;
        stringgrid1.Cells[8, stringgrid1.RowCount - 2] := inttostr(total);
      end;
      qy2.Next;
    end;
  end;
end;


procedure TMainForm.Label2DblClick(Sender: TObject);
begin
toolbutton1.Enabled:=not toolbutton1.Enabled;
end;

procedure TMainForm.BitBtn1Click(Sender: TObject);
var i: integer;
s, ss,dd_s,mm_s,yy_s,tt_s,telchar,     tele_dt, ext_num, dial_num, pas, stch: string;
  st_hh, st_mm, st_ss, ed_hh, ed_mm, ed_ss, dts_mm, dts_dd, dte_dd: word;
  yy, mm, dd: word;
  subs:integer ;
  total: double;
  nowdate: tdatetime;
begin

  telstr :='| 186|RO  |10000               |27/06/07 16-44|000:22|  3      |   10     |   5|';// telstr + s;
//            12345678901234567890123456789012345678901234567890123456789012345678901234567890
//                     1         2         3         4         5         6         7         8
  i :=1;// pos(#03, telstr);
  if i <> 0 then
  begin
    if stringgrid1.rowcount > 30 then
    begin
      stringgrid1.rowcount := 2;
      stringgrid1.Rows[1].Clear;
    end;
    with dddata do
    begin
      {qy1.sql.clear;
      qy1.sql.add('insert into telchar (telchar) values(:telchar)');
      qy1.ParamByName('telchar').asstring := telstr;
      qy1.ExecSQL;}

      nowdate := date;
      decodedate(nowdate, yy, mm, dd);
      telchar := telstr;
      ext_num := trimleft(copy(telchar, 2, 4));  //分机
      dial_num := copy(telchar, 12, 20); //话单
      pas := copy(telchar, 76, 4);  //密码
       st_hh := strtoint(copy(telchar, 42, 2));
       st_mm := strtoint(copy(telchar, 45, 2));
       st_ss := 00;//strtoint(copy(telchar, 29, 2));
      //ed_hh := strtoint(copy(telchar, 35, 2));
      ed_mm := strtoint(copy(telchar, 48, 3));
      ed_ss := strtoint(copy(telchar, 52, 2));
  //    yy:=      strtoint(copy(telchar, 33, 2));
      dd_s:=copy(telchar, 33, 2);
      mm_s:=copy(telchar, 36, 2);
      yy_s:=copy(telchar, 39, 2);
      tt_s:=copy(telchar, 42, 2)+':'+copy(telchar, 45, 2)+':00';

//      dts_mm := strtoint(copy(telchar, 36, 2));
 //     dts_dd := strtoint(copy(telchar, 39, 2));
//      dte_dd := strtoint(copy(telchar, 39, 2));
      tele_dt:=yy_s+'-'+mm_s+'-'+dd_s;
//      tele_dt :=formatdatetime('yyyy-mm-dd', tele_dt);
      stch := copy(dial_num, 1, 1);
      total :=strtofloat(copy(telchar, 65, 10))/10;  //话费
      subs :=(ed_mm * 60 + ed_ss);     //秒
      if stch = '0' then
      begin
      {  qy3.SQl.Clear;
        qy3.SQL.add('select * from telert ');
        qy3.sql.add(' where :dial_num like dial_cd+''%'' order by dial_cd desc ');
        qy3.ParamByName('dial_num').asstring := dial_num;
        qy3.open;
        if qy3.RecordCount > 0 then
        begin
          total := round(qy3.fieldbyname('dial_rt').asCurrency * trunc((subs + 59) / 60) + 0.49);
          qy4.sql.clear;
          qy4.SQL.Add('insert into teletrn(tele_dt,tele_flg,cntry_nm,st_tm,ed_tm,du_tm');
          qy4.SQL.Add(',tele_rt,tele_amt,dial_num,ext_num,rm_num)');
          qy4.SQL.Add(' values(:tele_dt,:tele_flg,:cntry_nm,:st_tm,:ed_tm,:du_tm');
          qy4.SQL.Add(',:tele_rt,:tele_amt,:dial_num,:ext_num,:rm_num)');
          qy4.ParamByName('tele_dt').asdatetime := tele_dt;
          qy4.ParamByName('tele_flg').asstring := inttostr(qy3.fieldbyname('type_cd').asinteger);
          qy4.ParamByName('cntry_nm').asstring := qy3.fieldbyname('cntry_nm').asstring;
          qy4.ParamByName('st_tm').asstring :=
            inttostr(st_hh) + ':' + inttostr(st_mm) + ':' + inttostr(st_ss);
          qy4.ParamByName('ed_tm').asstring :=
            inttostr(ed_hh) + ':' + inttostr(ed_mm) + ':' + inttostr(ed_ss);
          qy4.ParamByName('du_tm').asinteger := trunc((subs + 59) / 60);
          qy4.ParamByName('tele_rt').asCurrency := qy3.fieldbyname('dial_rt').asCurrency;
          qy4.ParamByName('tele_amt').asCurrency := total;
          qy4.ParamByName('dial_num').asstring := dial_num;
          qy4.ParamByName('ext_num').asstring := ext_num;
          qy4.ParamByName('rm_num').asstring := pas;
          qy4.ExecSQL;
          stringgrid1.RowCount := stringgrid1.RowCount + 1;
          stringgrid1.Cells[0, stringgrid1.RowCount - 2] := formatdatetime('yyyy-mm-dd', tele_dt);
          stringgrid1.Cells[1, stringgrid1.RowCount - 2] := dial_num;
          stringgrid1.Cells[2, stringgrid1.RowCount - 2] := ext_num;
          stringgrid1.Cells[3, stringgrid1.RowCount - 2] := pas;
          stringgrid1.Cells[4, stringgrid1.RowCount - 2] :=
            inttostr(st_hh) + ':' + inttostr(st_mm) + ':' + inttostr(st_ss);
//          stringgrid1.Cells[5, stringgrid1.RowCount - 2] := qy3.fieldbyname('cntry_nm').asstring;
          stringgrid1.Cells[6, stringgrid1.RowCount - 2] := inttostr(subs);//inttostr(trunc((subs + 59) / 60));
          stringgrid1.Cells[7, stringgrid1.RowCount - 2] := qy3.fieldbyname('dial_rt').asstring;
          stringgrid1.Cells[8, stringgrid1.RowCount - 2] := inttostr(total);
        end;}
      end
      else
      begin
       { qy3.SQl.Clear;
        qy3.SQL.add('select a.loc_head,a.discrpt,a.loc_rt  from telecnfg a   ');
        qy3.sql.add(' where :dial_num  like rtrim(ltrim(loc_head))+''%''');
        qy3.sql.add('order by loc_head desc ');
        qy3.ParamByName('dial_num').asstring := dial_num;
        qy3.open;
        if qy3.RecordCount > 0 then
        begin
          total := round(qy3.fieldbyname('loc_rt').asCurrency
            * trunc((subs + 59) / 60) + 0.49);}
          qy4.sql.clear;
          qy4.SQL.Add('insert into teletrn(ext_num,tel_dt,tel_num,tel_sc,total,tel_tt)');
          qy4.SQL.Add('values(:ext_num,:tel_dt,:tel_num,:tel_sc,:total,:tel_tt)');
          qy4.ParamByName('ext_num').asstring  := ext_num;
          qy4.ParamByName('tel_dt').asstring :=tele_dt;
          qy4.ParamByName('tel_tt').asstring  := tt_s;
          qy4.ParamByName('tel_num').asstring  :=dial_num;
          qy4.ParamByName('tel_sc').asinteger  := subs;
          qy4.ParamByName('total').asfloat := total;
          qy4.ExecSQL;
          stringgrid1.RowCount := stringgrid1.RowCount + 1;
          stringgrid1.Cells[0, stringgrid1.RowCount - 2] :=tele_dt;
          stringgrid1.Cells[1, stringgrid1.RowCount - 2] := dial_num;
          stringgrid1.Cells[2, stringgrid1.RowCount - 2] := ext_num;
          stringgrid1.Cells[3, stringgrid1.RowCount - 2] := pas;
          stringgrid1.Cells[4, stringgrid1.RowCount - 2] :=tt_s;//inttostr(st_hh) + ':' + inttostr(st_mm) + ':' + inttostr(st_ss);
          stringgrid1.Cells[5, stringgrid1.RowCount - 2] := '''';//qy3.fieldbyname('discrpt').asstring;
          stringgrid1.Cells[6, stringgrid1.RowCount - 2] :=inttostr(subs);//inttostr(trunc((subs + 59) / 60));
          stringgrid1.Cells[7, stringgrid1.RowCount - 2] := '''';//qy3.fieldbyname('loc_rt').asstring;
          stringgrid1.Cells[8, stringgrid1.RowCount - 2] := floattostr(total);
      //  end;
      end;
    end;
    edit1.Text:='';
    telstr := '';
  end;

end;

procedure TMainForm.BitBtn2Click(Sender: TObject);
begin
dept_m.show;
end;

procedure TMainForm.Button1Click(Sender: TObject);
var i: integer;
  s, ss,dd_s,mm_s,yy_s,tt_s,
  telchar,tele_dt,
    ext_num, dial_num, pas, stch: string;
  st_hh, st_mm, st_ss, ed_hh, ed_mm, ed_ss, dts_mm, dts_dd, dte_dd: word;
  yy, mm, dd: word;
  subs:integer ;
  total: double;
  nowdate : tdatetime;
begin
    //  showmessage(inttostr(length(edit1.text)));
     edit1.text:='  '+edit1.text;
     telchar:=edit1.text;
      edit2.text:= trimleft(copy(telchar,5,3));  //分机
      edit3.text:= copy(telchar, 14,15); //话单
      edit4.text:= copy(telchar, 44, 2);  //开始时
      edit5.text:=copy(telchar, 47, 2);   //开始分
      edit6.text:= '00';
      edit7.text := copy(telchar, 50, 3);
      edit8.text:= copy(telchar, 54, 2);
      edit9.text:=copy(telchar, 35, 2);
      edit10.text:=copy(telchar, 38, 2);
      edit11.text:=copy(telchar, 41, 2);
      edit12.text:=copy(telchar, 67, 10);

//////nowdate := date;
      decodedate(nowdate, yy, mm, dd);
   //    telchar:=telstr;
       //////////////////////////////
       ext_num :=trimleft(copy(telchar, 5, 3));  //分机
       dial_num := copy(telchar, 14,15); //话单
       st_hh := strtoint(copy(telchar, 44, 2));
       st_mm := strtoint(copy(telchar, 47, 2));
       st_ss := 00;
      ed_mm := strtoint(copy(telchar, 50, 3));
      ed_ss := strtoint(copy(telchar, 54, 2));
      dd_s:=copy(telchar, 35, 2);
      mm_s:=copy(telchar, 38, 2);
      yy_s:=copy(telchar, 41, 2);
      total :=strtofloat(copy(telchar, 67, 10))/10;
      tt_s:=inttostr(st_hh)+':'+inttostr(st_mm)+':00';
      tele_dt:=yy_s+'-'+mm_s+'-'+dd_s;
      subs :=(ed_mm * 60 + ed_ss);    //秒
      /////////////////////////////////////////
    with dddata do
      begin
          qy4.sql.clear;
          qy4.SQL.Add('insert into teletrn(ext_num,tel_dt,tel_num,tel_sc,total,tel_tt)');
          qy4.SQL.Add('values(:ext_num,:tel_dt,:tel_num,:tel_sc,:total,:tel_tt)');
          qy4.ParamByName('ext_num').asstring  := ext_num;
          qy4.ParamByName('tel_dt').asstring :=tele_dt;
          qy4.ParamByName('tel_tt').asstring  := tt_s;
          qy4.ParamByName('tel_num').asstring  :=dial_num;
          qy4.ParamByName('tel_sc').asinteger  := subs;
          qy4.ParamByName('total').asfloat := total;
          qy4.ExecSQL;

          /////////////////////////////////////// 进收银

  with qy1 do
   begin
    sql.clear;
    sql.add('select  sys_date,room_No,gdata_id,chn_name from  h_guest where  room_no=:fnum and    roomstate<''5''');
    parambyname('fnum').asstring:=ext_num;
    open;
   end;
//////////////////////////查到此房号
 if qy1.RecordCount>0 then
   begin

     with qy4 do
     begin
     sql.clear;
     sql.add('insert into pos_detail(remark, pos_detail_id,pos_master_id,sys_date,');
     sql.add('     sale_dept_no,starttime,menu_no,ispresent,qty,prc,amt,');
     sql.add('cook_method_no,made_sequence,inputuser,waiter,deliver,cashier,');
     sql.add(' salesman,payformasterid,printid,');
     sql.Add('print_no,printstate,endtime,state,cook_taste,checkstate,');
     sql.add(' printid_dl,print_no_dl,printcopies_dl,printstate_dl)');

     sql.Add('  values(:remark,:postd,'''',:dt1,''tel'',:dt2,:fnum  ,''+'',.00,.00,:amt,''manu'',');
     sql.add(' 0,:user,NULL,'''',''A'',''系统管理员'',NULL,''tel'',''_hkp'',');
     sql.add('0,NULL,1,:keren,1,NULL,'''' ,0,0)');
     ParamByName('user').asstring:=qy1.fieldbyname('gdata_id').Asstring;
     ParamByName('dt1').value:=qy1.fieldbyname('sys_date').value;
     ParamByName('postd').asstring:='';
     ParamByName('keren').asstring:=qy1.fieldbyname('chn_name').Asstring;
     ParamByName('dt2').asdatetime:=strtodatetime(tele_dt);
     ParamByName('remark').asstring:=dial_num;
     ParamByName('fnum').asstring :=ext_num;
     ParamByName('amt').asfloat:=total;
     execsql;
     end;     
  end;   ///////////////收银完毕



          ///////////////////////////////
          stringgrid1.RowCount := stringgrid1.RowCount + 1;
          stringgrid1.Cells[0, stringgrid1.RowCount - 2] :=tele_dt;
          stringgrid1.Cells[1, stringgrid1.RowCount - 2] := dial_num;
          stringgrid1.Cells[2, stringgrid1.RowCount - 2] := ext_num;
          stringgrid1.Cells[3, stringgrid1.RowCount - 2] := pas;
          stringgrid1.Cells[4, stringgrid1.RowCount - 2] :=tt_s;//inttostr(st_hh) + ':' + inttostr(st_mm) + ':' + inttostr(st_ss);
          stringgrid1.Cells[5, stringgrid1.RowCount - 2] := '''';//qy3.fieldbyname('discrpt').asstring;
          stringgrid1.Cells[6, stringgrid1.RowCount - 2] :=inttostr(subs);//inttostr(trunc((subs + 59) / 60));
          stringgrid1.Cells[7, stringgrid1.RowCount - 2] := '''';//qy3.fieldbyname('loc_rt').asstring;
          stringgrid1.Cells[8, stringgrid1.RowCount - 2] := floattostr(total);
    end;

     { edit1.text:='';
      telchar:='';
      telstr := '';      }

end;

end.

⌨️ 快捷键说明

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