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

📄 js_select.pas

📁 汽配前台收费,一个具有详细功能的小系统
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit js_select;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Db, DBTables, StdCtrls, Buttons, ExtCtrls;

type
  Tfrm_js_select = class(TForm)
    pe_1: TPanel;
    rb_fk: TRadioButton;
    rb_gz: TRadioButton;
    pe_2: TPanel;
    Label1: TLabel;
    combo_fs: TComboBox;
    Label2: TLabel;
    txt_yh_zf: TEdit;
    Label3: TLabel;
    txt_yh_je: TEdit;
    cmd_js: TBitBtn;
    cmd_cancel: TBitBtn;
    sp_up_cl_dj1: TStoredProc;
    qe_jy: TQuery;
    sp_insert_into_day: TStoredProc;
    sp_insert_into_sj: TStoredProc;
    sp_up_pj_add2: TStoredProc;
    sp_up_cl4: TStoredProc;
    Panel1: TPanel;
    cb_pj: TCheckBox;
    cb_cmz: TCheckBox;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormDestroy(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure cmd_cancelClick(Sender: TObject);
    procedure cmd_jsClick(Sender: TObject);
    procedure txt_yh_zfKeyPress(Sender: TObject; var Key: Char);
    procedure rb_fkClick(Sender: TObject);
    procedure rb_gzClick(Sender: TObject);
  private
    { Private declarations }
    int1, int2: integer;
    arrayBH: array[0..3] of string;
    //
    procedure Print_fkd(m_fk: Double);
    procedure Print_sbd(m_fk: Double);
    procedure Print_qkd(m_fk: Double);
    procedure Print_hkd(m_fk: Double);
    procedure Print_cmz;
    function SetNewBH(intKind: integer): string;
  public
    { Public declarations }
    cur_bh: string;
    cur_cph: string;
    cur_cx: string;
    cur_cz: string;
    cur_czdw: string;
    //
    cur_wx_kind: string;
    //
    cur_clf: Double;
    cur_fjf: Double;
    cur_gsf: Double;
    cur_sbf: Double;
    cur_yjf: Double;
    cur_cbf: Double;
  end;

var
  frm_js_select: Tfrm_js_select;

implementation

{$R *.DFM}

uses
  log, print, main, qt_js;

function Tfrm_js_select.SetNewBH(intKind: integer): string;
var
  intR_m, intR_d: integer;
  stryear, strmonth, strday: string;
  year, month, day: Word;
  strm, strd: string;
  strResult: string;
begin
  DecodeDate(Now, year, month, day);
  stryear := IntToStr(year);
  strmonth := Format('%2.2d', [month]);
  strday := Format('%2.2d', [day]);
  //
  qe_jy.Close;
  qe_jy.SQL.Clear;
  qe_jy.SQL.Add('SELECT * FROM SJ_SUM WHERE SJ_YEAR = ' + IntToStr(year) + ' AND SJ_MONTH = ' + IntToStr(month) + ' AND SJ_DAY = ' + IntToStr(day) + ' AND SJ_KIND = ' + IntToStr(intKind) + ' ');
  qe_jy.Open;
  qe_jy.Last;
  intR_d := qe_jy.RecordCount;
  //
  qe_jy.Close;
  qe_jy.SQL.Clear;
  qe_jy.SQL.Add('SELECT * FROM SJ_SUM WHERE SJ_YEAR = ' + IntToStr(year) + ' AND SJ_MONTH = ' + IntToStr(month) + ' AND SJ_KIND = ' + IntToStr(intKind) + ' ');
  qe_jy.Open;
  qe_jy.Last;
  intR_m := qe_jy.RecordCount;
  qe_jy.Close;
  //
  if (intR_m = 0) and (intR_d = 0) then begin
    strResult := stryear + strmonth + strday + '-' + '001' + '-' + '001';
  end else if intR_m = 0 then begin
    strResult := stryear + strmonth + strday + '-' + '001' + '-' + '001';
  end else if intR_d = 0 then begin
    intR_m := intR_m + 1;
    strm := Format('%3.3d', [intR_m]);
    strResult := stryear + strmonth + strday + '-' + strm + '-' + '001';
  end else begin
    intR_m := intR_m + 1;
    intR_d := intR_d + 1;
    strm := Format('%3.3d', [intR_m]);
    strd := Format('%3.3d', [intR_d]);
    strResult := stryear + strmonth + strday + '-' + strm + '-' + strd;
  end;
  //
  sp_insert_into_sj.ParamByName('@iyear').Value := year;
  sp_insert_into_sj.ParamByName('@imonth').Value := month;
  sp_insert_into_sj.ParamByName('@iday').Value := day;
  sp_insert_into_sj.ParamByName('@ikind').Value := intKind;
  sp_insert_into_sj.ExecProc;
  //
  Result := strResult;
end;

procedure Tfrm_js_select.Print_cmz;
begin
  //frm_print.pc_main.ActivePageIndex := 13;
  frm_print.lbl_cap11.Caption := frm_log.cur_gs_name;
  frm_print.lbl_date13.Caption := frm_log.controlDate(DateToStr(Date()));
  frm_print.lbl_bh13.Caption := cur_bh;
  frm_print.lbl_cz13.Caption := cur_cz;
  frm_print.lbl_czdw13.Caption := cur_czdw;
  frm_print.lbl_cph13.Caption := cur_cph;
  frm_print.lbl_cx13.Caption := cur_cx;
  frm_print.qr_cmz.Print;
end;

procedure Tfrm_js_select.Print_fkd(m_fk: Double);
var
  m_fk1: Double;
begin
  if (int1 = 0) and (int2 = 0) then begin
    m_fk1 := m_fk - cur_yjf;
    if m_fk1 < 0.01 then m_fk1 := 0;
    if m_fk1 > 0.01 then begin
      sp_insert_into_day.ParamByName('@idate').Value := frm_log.controlDate(DateToStr(Date()));
      sp_insert_into_day.ParamByName('@izy').Value := '(修车结算)-' + cur_cph + '-' + cur_cx + '收款';
      if combo_fs.ItemIndex = 0 then
        sp_insert_into_day.ParamByName('@ikm').Value := '现金'
      else
        sp_insert_into_day.ParamByName('@ikm').Value := '银行存款';
      sp_insert_into_day.ParamByName('@ijf').Value := m_fk1;
      sp_insert_into_day.ParamByName('@idf').Value := 0;
      sp_insert_into_day.ParamByName('@izy_id').Value := 1;
      sp_insert_into_day.ParamByName('@idj_bh').Value := cur_bh;
      sp_insert_into_day.ExecProc;
    end;
    //
    arrayBH[0] := SetNewBH(0);
  end;
  if cb_pj.Checked then begin
    frm_print.pc_main.ActivePageIndex := 5;
    frm_print.lbl_cap5.Caption := frm_log.cur_gs_name;
    frm_print.lbl_tel5.Caption := frm_log.cur_gs_tel;
    frm_print.lbl_addr5.Caption := frm_log.cur_gs_addr;
    frm_print.lbl_d1.Caption := frm_log.controlDate(DateToStr(Date()));
    frm_print.lbl_h1.Caption := 'SK' + arrayBH[0];
    if combo_fs.Enabled then
      frm_print.lbl_f1.Caption := combo_fs.Text
    else
      frm_print.lbl_f1.Caption := '现金';
    frm_print.lbl_r1.Caption := cur_cz;
    frm_print.lbl_w1.Caption := cur_czdw;
    frm_print.lbl_c1.Caption := cur_cph;
    frm_print.lbl_x1.Caption := cur_cx;
    //
    m_fk1 := Int(m_fk) + Round((Frac(m_fk)*100))/100;
    frm_print.lbl_dx1.Caption := frm_log.shiftNum(m_fk1);
    frm_print.lbl_xx1.Caption := frm_log.ControlNum(FloatToStr(m_fk1)) + '元';
    //
    frm_print.lbl_z1.Caption := frm_main.user_name;
    frm_print.qr_fk.Print;
  end;
end;

procedure Tfrm_js_select.Print_sbd(m_fk: Double);
var
  m_fk1: Double;
begin
  if (int1 = 0) and (int2 = 0) then begin
    sp_insert_into_day.ParamByName('@idate').Value := frm_log.controlDate(DateToStr(Date()));
    sp_insert_into_day.ParamByName('@izy').Value := '(修车结算)-' + cur_cph + '-' + cur_cx + '三包';
    sp_insert_into_day.ParamByName('@ikm').Value := '应收账款';
    sp_insert_into_day.ParamByName('@ijf').Value := m_fk;
    sp_insert_into_day.ParamByName('@idf').Value := 0;
    sp_insert_into_day.ParamByName('@izy_id').Value := 2;
    sp_insert_into_day.ParamByName('@idj_bh').Value := cur_bh;
    sp_insert_into_day.ExecProc;
    //
    arrayBH[2] := SetNewBH(2);
  end;
  //
  if cb_pj.Checked then begin
    frm_print.pc_main.ActivePageIndex := 6;
    frm_print.lbl_cap6.Caption := frm_log.cur_gs_name;
    frm_print.lbl_tel6.Caption := frm_log.cur_gs_tel;
    frm_print.lbl_addr6.Caption := frm_log.cur_gs_addr;
    frm_print.lbl_d2.Caption := frm_log.controlDate(DateToStr(Date()));
    frm_print.lbl_h2.Caption := 'SB' + arrayBH[2];
    frm_print.lbl_r2.Caption := cur_cz;
    frm_print.lbl_w2.Caption := cur_czdw;
    frm_print.lbl_c2.Caption := cur_cph;
    frm_print.lbl_x2.Caption := cur_cx;
    //
    m_fk1 := Int(m_fk) + Round((Frac(m_fk)*100))/100;
    frm_print.lbl_dx2.Caption := frm_log.shiftNum(m_fk1);
    frm_print.lbl_xx2.Caption := frm_log.ControlNum(FloatToStr(m_fk1)) + '元';
    //
    frm_print.lbl_z2.Caption := frm_main.user_name;
    frm_print.qr_sb.Print;
  end;  
end;

procedure Tfrm_js_select.Print_qkd(m_fk: Double);
var
  m_fk1: Double;
begin
  if (int1 = 0) and (int2 = 0) then begin
    sp_insert_into_day.ParamByName('@idate').Value := frm_log.controlDate(DateToStr(Date()));
    sp_insert_into_day.ParamByName('@izy').Value := '(修车结算)-' + cur_cph + '-' + cur_cx + '挂帐';
    sp_insert_into_day.ParamByName('@ikm').Value := '应收账款';
    sp_insert_into_day.ParamByName('@ijf').Value := m_fk;
    sp_insert_into_day.ParamByName('@idf').Value := 0;
    sp_insert_into_day.ParamByName('@izy_id').Value := 3;
    sp_insert_into_day.ParamByName('@idj_bh').Value := cur_bh;
    sp_insert_into_day.ExecProc;
    //
    arrayBH[1] := SetNewBH(1);
  end;
  //
  if cb_pj.Checked then begin
    frm_print.pc_main.ActivePageIndex := 7;
    frm_print.lbl_cap7.Caption := frm_log.cur_gs_name;
    frm_print.lbl_tel7.Caption := frm_log.cur_gs_tel;
    frm_print.lbl_addr7.Caption := frm_log.cur_gs_addr;
    frm_print.lbl_d3.Caption := frm_log.controlDate(DateToStr(Date()));
    frm_print.lbl_h3.Caption := 'QK' + arrayBH[1];
    frm_print.lbl_r3.Caption := cur_cz;
    frm_print.lbl_w3.Caption := cur_czdw;
    frm_print.lbl_c3.Caption := cur_cph;
    frm_print.lbl_x3.Caption := cur_cx;
    //
    m_fk1 := Int(m_fk) + Round((Frac(m_fk)*100))/100;
    frm_print.lbl_dx3.Caption := frm_log.shiftNum(m_fk1);
    frm_print.lbl_xx3.Caption := frm_log.ControlNum(FloatToStr(m_fk1)) + '元';
    //
    frm_print.lbl_z3.Caption := frm_main.user_name;
    frm_print.qr_qk.Print;
  end;  
end;

procedure Tfrm_js_select.Print_hkd(m_fk: Double);
var
  m_fk1: Double;
begin
  if (int1 = 0) and (int2 = 0) then begin
    sp_insert_into_day.ParamByName('@idate').Value := frm_log.controlDate(DateToStr(Date()));
    sp_insert_into_day.ParamByName('@izy').Value := '(修车结算)-' + cur_cph + '-' + cur_cx + '付款';
    sp_insert_into_day.ParamByName('@ikm').Value := '现金';
    sp_insert_into_day.ParamByName('@ijf').Value := 0;
    sp_insert_into_day.ParamByName('@idf').Value := m_fk;
    sp_insert_into_day.ParamByName('@izy_id').Value := 1;
    sp_insert_into_day.ParamByName('@idj_bh').Value := cur_bh;
    sp_insert_into_day.ExecProc;
    //
    arrayBH[3] := SetNewBH(3);
  end;
  //
  if cb_pj.Checked then begin
    frm_print.pc_main.ActivePageIndex := 8;
    frm_print.lbl_cap8.Caption := frm_log.cur_gs_name;
    frm_print.lbl_tel8.Caption := frm_log.cur_gs_tel;
    frm_print.lbl_addr8.Caption := frm_log.cur_gs_addr;
    frm_print.lbl_d4.Caption := frm_log.controlDate(DateToStr(Date()));
    frm_print.lbl_h4.Caption := 'HK' + arrayBH[3];
    frm_print.lbl_r4.Caption := cur_cz;
    frm_print.lbl_w4.Caption := cur_czdw;
    frm_print.lbl_c4.Caption := cur_cph;
    frm_print.lbl_x4.Caption := cur_cx;

⌨️ 快捷键说明

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