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

📄 print_fp_un.pas

📁 布林电话收费管理系统
💻 PAS
字号:
unit print_fp_un;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, stand_un, BusinessSkinForm, bsSkinCtrls, QuickRpt, QRCtrls,
  ExtCtrls,math;

type
  Tprin_fp = class(Tstand)
    bsSkinPanel1: TbsSkinPanel;
    bsSkinXFormButton6: TbsSkinXFormButton;
    bsSkinXFormButton2: TbsSkinXFormButton;
    bsSkinXFormButton3: TbsSkinXFormButton;
    QuickRep1: TQuickRep;
    QRBand1: TQRBand;
    QRLabel3: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    QRLabel13: TQRLabel;
    QRLabel14: TQRLabel;
    QRLabel16: TQRLabel;
    QRLabel17: TQRLabel;
    QRLabel18: TQRLabel;
    QRLabel19: TQRLabel;
    QRRichText1: TQRRichText;
    QRRichText2: TQRRichText;
    QRLabel1: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel4: TQRLabel;
    QRLabel5: TQRLabel;
    QRLabel6: TQRLabel;
    procedure bsSkinXFormButton3Click(Sender: TObject);
    procedure bsSkinXFormButton6Click(Sender: TObject);
    procedure start_data(var sj_no:string);
    procedure bsSkinXFormButton2Click(Sender: TObject);
    procedure QuickRep1AfterPrint(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  prin_fp: Tprin_fp;

implementation
  uses globe,dm_un,main_un;
{$R *.dfm}

procedure Tprin_fp.bsSkinXFormButton3Click(Sender: TObject);
begin
  inherited;
 close;
end;

procedure Tprin_fp.bsSkinXFormButton6Click(Sender: TObject);
begin
  inherited;
  quickrep1.Prepare;
  quickrep1.Preview;
end;

procedure tprin_fp.start_data(var sj_no:string);
var
 htmx:string;
begin
 htmx:='';
 pub_var:=sj_no;
 with dm do
  begin
   q_a.Close;
   q_a.SQL.Clear;
   q_a.SQL.Add('select * from TEL_UP_MX where up_bh=:up_bh');
   q_a.Parameters.ParamByName('up_bh').Value:=sj_no;
   q_a.Prepared;
   q_a.Open;
  end;
//  qrlabel3.Caption:=system_dw+'用户话费收据联';
  qrlabel3.Caption:='';
  qrlabel11.Caption:=dm.q_a.FieldValues ['UP_NAME'];
  qrlabel12.Caption:=dm.q_a.FieldValues ['UP_TEL'];
  qrlabel13.Caption:=dm.q_a.FieldValues ['UP_bh'];
  qrlabel14.Caption:='用户交费用途:'+dm.q_a.FieldValues ['UP_lb'];
  if dm.q_a.FieldValues ['UP_hf']>0 then
   begin
    //如果交了用户的话费
    htmx:='用户的通话费用为:';
    with dm do
     begin
      q_b.Close;
      q_b.SQL.Clear;
      q_b.SQL.Add('select sum(round((e_time-b_time)*1000,2)) as sj,sum(total_money) as sum_1 from tel_yes');
      q_b.SQL.Add('where zj_tel=:zj_tel and tel_jfsj=:tel_jfsj');
      q_b.Parameters.ParamByName('zj_tel').Value:=q_a.FieldValues ['UP_TEL'];
      q_b.Parameters.ParamByName('tel_jfsj').Value:=q_a.FieldValues ['UP_date'];
      q_b.Prepared;
      q_b.Open;
     end;
     htmx:=htmx+floattostr(roundto(dm.q_b.FieldValues ['sum_1'],-2))+chr(13);
     htmx:=htmx+'用户的合计通话时间为:  '+floattostr(roundto(dm.q_b.FieldValues ['sj'],-2))+'分钟'+chr(13);
     htmx:=htmx+'其中分项话费为: '+chr(13);
    with dm do
     begin
      q_b.Close;
      q_b.SQL.Clear;
      q_b.SQL.Add('select sum(round((e_time-b_time)*1000,2)) as sj,sum(total_money) as sum_1,fl_name from tel_yes');
      q_b.SQL.Add('where zj_tel=:zj_tel and tel_jfsj=:tel_jfsj group by fl_name');
      q_b.Parameters.ParamByName('zj_tel').Value:=q_a.FieldValues ['UP_TEL'];
      q_b.Parameters.ParamByName('tel_jfsj').Value:=q_a.FieldValues ['UP_date'];
      q_b.Prepared;
      q_b.Open;
     end;
     while not dm.q_b.Eof do
      begin
       htmx:=htmx+'  '+dm.q_b.FieldValues ['fl_name']+' 通话时间'+floattostr(roundto(dm.q_b.FieldValues ['sj'],-2))+'分钟  '+'费用为:'+floattostr(roundto(dm.q_b.FieldValues ['sum_1'],-2))+chr(13);
       dm.q_b.Next;
      end;
   end
  else
   begin
     //如果没有产生话费
     htmx:='用户的通话费用为: 0.00'+chr(13)+'用户通话分类费用为: 0.00'+CHR(13)+'用户的通话时间为: 0分钟';
   end;
  qrrichtext2.Lines.Text:=htmx;
  //计算用户的服务费用
  if dm.q_a.FieldValues ['UP_fwje']>0 then
   begin
    //用户当时交了服务费
    htmx:='用户本次交费服务费金额为: '+floattostr(dm.q_a.FieldValues ['up_fwje'])+chr(13)+'其中:'+chr(13)+'              ';
    with dm do
     begin
       q_c.Close;
       q_c.sql.Clear;
       q_c.SQL.Add('select * from tel_cgyw');
       q_c.Prepared;
       q_c.Open;
     end;
     while not dm.q_c.Eof do
      begin
        if pos(dm.q_c.FieldValues ['yw_id'],dm.q_a.FieldValues ['up_fw'])<>0 then
          htmx:=htmx+dm.q_c.FieldValues ['yw_name']+' 每月收费为:'+floattostr(dm.q_c.FieldValues ['yw_money'])+chr(13)+'              ';
        dm.q_c.Next;
      end;
   end
  else
   begin
    //用户当时没有服务费
    htmx:='用户本次交费不发生服务费';
   end;
//  qrrichtext1.Lines.Text:=htmx;
  qrrichtext2.Lines.Text:=qrrichtext2.Lines.Text+chr(13)+chr(13)+htmx;
  qrlabel17.Caption:=floattostr(dm.q_a.FieldValues ['UP_je']);
  qrlabel18.Caption:=floattostr(dm.q_a.FieldValues ['UP_hf']+dm.q_a.FieldValues ['up_fwje']);
  qrlabel19.Caption:=floattostr(dm.q_a.FieldValues ['UP_ye']);
  qrlabel1.Caption:=datetimetostr(dm.q_a.FieldValues ['up_date']);
  qrlabel6.Caption:=datetimetostr(dm.q_a.FieldValues ['up_date'])+'以前';
  qrlabel7.Caption:=datetostr(dm.q_a.FieldValues ['user_time']);
  qrlabel4.Caption:=dm.q_a.FieldValues ['UP_user'];
  qrlabel5.Caption:=system_dw;
  qrlabel2.Caption:=convertcurrtochineses(dm.q_a.FieldValues ['UP_je']);
  qrlabel16.Caption:='';
//  qrlabel7.Caption:=
//  qrlabel16.Caption:='操作员工号为:'+dm.q_a.FieldValues ['UP_user']+'   收据收款日期为:'+datetimetostr(dm.q_a.FieldValues ['user_time'])+'   收据结帐日期为:'+datetimetostr(dm.q_a.FieldValues ['up_date']);
end;

procedure Tprin_fp.bsSkinXFormButton2Click(Sender: TObject);
begin
  inherited;
  quickrep1.Print;
end;

procedure Tprin_fp.QuickRep1AfterPrint(Sender: TObject);
var
 abc,bcd:string;
begin
  inherited;
  abc:=pub_var;
  with dm do
   begin
    q_e.Close;
    q_e.SQL.Clear;
    q_e.SQL.Add('select * from tel_up_mx where up_bh=:up_bh');
    q_e.Parameters.ParamByName('up_bh').value:=abc;
    q_e.Prepared;
    q_e.Open;
    bcd:=q_e.FieldValues ['up_prn'];
    if varisnull(bcd) then
     bcd:='0'
    else
     bcd:=inttostr(strtoint(bcd)+1);
    q_e.Close;
    q_3.Close;
    q_3.SQL.Clear;
    q_3.SQL.Add('update tel_up_mx set up_prn=:up_prn where up_bh=:up_bh');
    q_3.Parameters.ParamByName('up_prn').Value:=bcd;
    q_3.Parameters.ParamByName('up_bh').Value:=abc;
    q_3.Prepared;
    q_3.ExecSQL;
   end;
end;

end.

⌨️ 快捷键说明

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