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

📄 js_select.pas

📁 汽配前台收费,一个具有详细功能的小系统
💻 PAS
📖 第 1 页 / 共 2 页
字号:
    //
    m_fk1 := Int(m_fk) + Round((Frac(m_fk)*100))/100;
    frm_print.lbl_dx4.Caption := frm_log.shiftNum(m_fk1);
    frm_print.lbl_xx4.Caption := frm_log.ControlNum(FloatToStr(m_fk1)) + '元';
    //
    frm_print.lbl_z4.Caption := frm_main.user_name;
    frm_print.qr_hk.Print;
  end;  
end;

procedure Tfrm_js_select.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  qe_jy.Close;
  //
  Action := caFree;
end;

procedure Tfrm_js_select.FormDestroy(Sender: TObject);
begin
  qe_jy := nil;
  //
  frm_js_select := nil;
end;

procedure Tfrm_js_select.FormShow(Sender: TObject);
begin
  if (cur_wx_kind = '三包') or (cur_gsf + cur_clf + cur_fjf < 0.01) then begin
    rb_gz.Checked := True;
    rb_gz.Enabled := False;
    rb_fk.Enabled := False;
    txt_yh_zf.Enabled := False;
    combo_fs.Enabled := False;
    txt_yh_je.SetFocus;
  end else begin
    if Abs(cur_yjf - cur_gsf - cur_clf - cur_fjf) < 0.01 then begin
      txt_yh_zf.Enabled := False;
      txt_yh_zf.Tag := 2;
      txt_yh_je.SetFocus;
    end else if cur_yjf - cur_gsf - cur_clf - cur_fjf > 0 then begin
      txt_yh_zf.Enabled := False;
      txt_yh_zf.Tag := 2;
      txt_yh_je.SetFocus;
    end else begin
      txt_yh_zf.Enabled := True;
      txt_yh_zf.Tag := 1;
      txt_yh_zf.SetFocus;
    end;
  end;
end;

procedure Tfrm_js_select.cmd_cancelClick(Sender: TObject);
begin
  Close;
end;

procedure Tfrm_js_select.cmd_jsClick(Sender: TObject);
var
  f, h: Double;
  v: Double;
  code: integer;
  v1: Double;
  f_je: Double;
begin
  cmd_js.Enabled := False;
  //
  qe_jy.Close;
  qe_jy.SQL.Clear;
  qe_jy.SQL.Add('SELECT * FROM CL_DJ WHERE DJ_BH = ''' + cur_bh + ''' AND DJ_ZF_BS = 0');
  qe_jy.Open;
  qe_jy.First;
  //
  if (qe_jy.Bof) and (qe_jy.Eof) then begin
    MessageBox(Handle, '该登记已经作废,不能结算', '沈阳信德', MB_ICONQUESTION or MB_OK);
    qe_jy.Close;
    cmd_js.Enabled := True;
    Exit;
  end else begin
    int1 := qe_jy.FieldByName('dj_js_bs').AsInteger;
    int2 := qe_jy.FieldByName('dj_js_print').AsInteger;
    //
    if (int1 = 1) and (int2 = 1) then begin
      MessageBox(Handle, '此次结算单据已经打印,要想重新打印请通知财务员', '沈阳信德', MB_ICONQUESTION or MB_OK);
      cmd_js.Enabled := True;
      Exit;
    end;
  end;
  //
  if Trim(txt_yh_je.Text) = '' then
    h := 0
  else begin
    Val(Trim(txt_yh_je.Text), v, code);
    if (code <> 0) then begin
      MessageBox(Handle, '优惠金额无效', '沈阳信德', MB_ICONQUESTION or MB_OK);
      txt_yh_je.SetFocus;
      cmd_js.Enabled := True;
      Exit;
    end;
    v := Int(v) + Round((Frac(v)*100))/100;
    if v < 0.01 then v := 0;
    h := v;
  end;
  //
  if Trim(txt_yh_zf.Text) = '' then
    f := 0
  else begin
    Val(Trim(txt_yh_zf.Text),v, code);
    if (code <> 0) then begin
      MessageBox(Handle, '支付金额无效', '沈阳信德', MB_ICONQUESTION or MB_OK);
      txt_yh_zf.SetFocus;
      cmd_js.Enabled := True;
      Exit;
    end;
    v := Int(v) + Round((Frac(v)*100))/100;
    if v < 0.01 then v := 0;
    f := v;
  end;
  //
  if (rb_fk.Checked) and (combo_fs.ItemIndex = -1) then begin
    MessageBox(Handle, '请确定收款方式', '沈阳信德', MB_ICONQUESTION or MB_OK);
    combo_fs.SetFocus;
    cmd_js.Enabled := True;
    Exit;
  end;
  //
  if not rb_gz.Enabled then begin
    f_je := h - cur_sbf;
    if (Abs(f_je) < 0.01) or (f_je > 0) then begin
      MessageBox(Handle, '优惠金额超界!', '沈阳信德', MB_ICONQUESTION or MB_OK);
      txt_yh_je.SetFocus;
      cmd_js.Enabled := True;
      Exit;
    end;
    print_sbd(cur_sbf - h);
    if cur_yjf > 0.01 then print_hkd(cur_yjf);
    f := 0;
  end else begin
    if rb_fk.Checked then begin
      f_je := (f + h + cur_yjf) - (cur_clf + cur_gsf + cur_fjf);
      if Abs(f_je) < 0.01 then begin
        f := f + cur_yjf;
        if f < 0.01 then begin
          MessageBox(Handle, '收款金额不能为零', '沈阳信德', MB_ICONQUESTION or MB_OK);
          txt_yh_zf.SetFocus;
          cmd_js.Enabled := True;
          Exit;
        end;
        print_fkd(f);
      end else if f_je < 0 then begin
        if f < 0.01 then begin
          MessageBox(Handle, '收款金额不能为零', '沈阳信德', MB_ICONQUESTION or MB_OK);
          txt_yh_zf.SetFocus;
          cmd_js.Enabled := True;
          Exit;
        end;
        f := f + cur_yjf;
        print_fkd(f);
        print_qkd(cur_clf + cur_gsf + cur_fjf - f - h);
      end else if f_je > 0 then begin
        if txt_yh_zf.Enabled then begin
          MessageBox(Handle, '收款金额超界', '沈阳信德', MB_ICONQUESTION or MB_OK);
          txt_yh_zf.SetFocus;
          cmd_js.Enabled := True;
          Exit;
        end else begin
          f := cur_clf + cur_gsf + cur_fjf - h;
          if Abs(f) < 0.01 then begin
            MessageBox(Handle, '此项业务免费!', '沈阳信德', MB_ICONQUESTION or MB_OK);
            sp_up_cl4.ParamByName('@ipos').Value := 3;
            sp_up_cl4.ParamByName('@ibh').Value := cur_bh;
            sp_up_cl4.ExecProc;
            f := 0;
            print_hkd(cur_yjf);
          end else if f < 0 then begin
            MessageBox(Handle, '优惠金额超界!', '沈阳信德', MB_ICONQUESTION or MB_OK);
            txt_yh_je.SetFocus;
            cmd_js.Enabled := True;
            Exit;
          end else if f > 0 then begin
            print_fkd(f);
            print_hkd(cur_yjf - f);
          end;
        end;
      end;
    end else if rb_gz.Checked then begin
      if cur_yjf = 0 then begin
        f_je := h - cur_clf - cur_gsf - cur_fjf;
        if (Abs(f_je) < 0.01) then begin
          MessageBox(Handle, '此项业务免费!', '沈阳信德', MB_ICONQUESTION or MB_OK);
          sp_up_cl4.ParamByName('@ipos').Value := 3;
          sp_up_cl4.ParamByName('@ibh').Value := cur_bh;
          sp_up_cl4.ExecProc;
          f := 0;
        end else if f_je > 0 then begin
          MessageBox(Handle, '优惠金额超界!', '沈阳信德', MB_ICONQUESTION or MB_OK);
          txt_yh_je.SetFocus;
          cmd_js.Enabled := True;
          Exit;
        end else begin
          f := 0;
          print_qkd(cur_clf + cur_gsf + cur_fjf - h);
        end;
      end else if cur_yjf > 0 then begin
        v1 := (cur_yjf) - (cur_clf + cur_gsf + cur_fjf);
        if (Abs(v1) < 0.01) or (v1 > 0.01) then begin
          MessageBox(Handle, '不能进行挂帐,必须付款!', '沈阳信德', MB_ICONQUESTION or MB_OK);
          cmd_js.Enabled := True;
          Exit;
        end else begin
          v1 := (cur_yjf + h) - (cur_clf + cur_gsf + cur_fjf);
          if v1 > 0.01 then begin
            MessageBox(Handle, '优惠金额超界!', '沈阳信德', MB_ICONQUESTION or MB_OK);
            txt_yh_je.SetFocus;
            cmd_js.Enabled := True;
            Exit;
          end else begin
            f := cur_yjf;
            if (Abs(v1) < 0.01) then
              print_fkd(f)
            else begin
              print_qkd(cur_clf + cur_gsf + cur_fjf - cur_yjf - h);
              print_fkd(f);
            end;
          end;
        end;
      end;
    end;
    //
    if cur_sbf > 0 then print_sbd(cur_sbf);
  end;
  //
  if cb_cmz.Checked then
    print_cmz;
  //
  sp_up_cl_dj1.ParamByName('@ibh').Value := cur_bh;
  sp_up_cl_dj1.ParamByName('@iyh_zf').Value := f;
  if not rb_gz.Enabled then begin
    sp_up_cl_dj1.ParamByName('@iyh_je').Value := 0;
    sp_up_cl_dj1.ParamByName('@iyh_je1').Value := h;
  end else begin
    sp_up_cl_dj1.ParamByName('@iyh_je').Value := h;
    sp_up_cl_dj1.ParamByName('@iyh_je1').Value := 0;
  end;
  sp_up_cl_dj1.ParamByName('@ipj_je').Value := cur_clf;
  sp_up_cl_dj1.ParamByName('@igs_je').Value := cur_gsf;
  sp_up_cl_dj1.ParamByName('@isb_je').Value := cur_sbf;
  sp_up_cl_dj1.ParamByName('@ifj_je').Value := cur_fjf;
  sp_up_cl_dj1.ParamByName('@icb_je').Value := cur_cbf;
  sp_up_cl_dj1.ParamByName('@ijs_time').Value := frm_log.controlDate(DateToStr(Date()));
  sp_up_cl_dj1.ExecProc;
  //
  sp_up_pj_add2.ParamByName('@ipos').Value := 1;
  sp_up_pj_add2.ParamByName('@idj_bh').Value := cur_bh;
  sp_up_pj_add2.ParamByName('@idate').Value := frm_log.controlDate(DateToStr(Date()));
  sp_up_pj_add2.ExecProc;
  //
  pe_1.Enabled := False;
  pe_2.Enabled := False;
  //
  frm_qt_js.cmd_js.Enabled := False;
  //
  cmd_js.Enabled := True;
end;

procedure Tfrm_js_select.txt_yh_zfKeyPress(Sender: TObject; var Key: Char);
begin
  if not (((Key >= '0') and (Key <= '9')) or (Ord(Key) = 8) or (Ord(Key) = 46) or (Ord(Key) = 13)) then
    Key := Chr(0);
end;

procedure Tfrm_js_select.rb_fkClick(Sender: TObject);
begin
  combo_fs.ItemIndex := -1;
  combo_fs.Enabled := True;
  txt_yh_zf.Text := '';
  txt_yh_je.Text := '';
  if txt_yh_zf.Tag = 1 then
    txt_yh_zf.Enabled := True
  else if txt_yh_zf.Tag = 2 then
    txt_yh_zf.Enabled := False;
  combo_fs.SetFocus;
end;

procedure Tfrm_js_select.rb_gzClick(Sender: TObject);
begin
  combo_fs.ItemIndex := -1;
  txt_yh_zf.Text := '';
  txt_yh_je.Text := '';
  txt_yh_zf.Enabled := False;
  combo_fs.Enabled := False;
  txt_yh_je.SetFocus;
end;

end.

⌨️ 快捷键说明

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