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

📄 ywwizard.pas

📁 企业端数据申报系统:单位管理模块 单位查询. 业务申报模块 在线数据下载 在线数据上传 在线业务申核 申报业务查询 磁盘数据导出 磁盘数据导入 在线业务模块 在线业务
💻 PAS
📖 第 1 页 / 共 5 页
字号:
          DE_othchg_cgdate.Text:=FormatDateTime('yyyy-mm-dd',today);
          M_othchg_notes.Text:='';
        end;

        if not UptypeCanDo(ls_status,uptype) then
        begin
          application.MessageBox(pchar('此人状态为【'+QueryCodeName(ls_status,'status')+'】,不能做【'+QueryCodeName(uptype,'uptype')+'】!'),'恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
          exit;
        end;
        E_othchg_iscode.Text:=iscode;
        E_othchg_agcardno.Text:=ls_agcardno;
        E_othchg_psname.Text:=ls_psname;
        E_othchg_sex.Text:=QueryCodeName(ls_sex,'sex');
        TC_othchg.Tabs.Strings[0]:=QueryCodeName(uptype,'uptype');
        TC_othchg.Visible:=true;
        TC_new.Visible:=false;
        TC_loctran.Visible:=false;
      end;
    ///////////////
    end else
    if uptype='04' then
    begin
      with datashare_form.Query1 do
      begin
        ls_sql:='select manid,status,agcardno,psname,sex,organid,rewage from psarch where trim(iscode)='+#39+iscode+#39;
        close;
        sql.Clear;
        sql.Add(ls_sql);
        prepare;
        open;
        if RecordCount=0 then
        begin
          application.MessageBox(pchar('此人不存在,不能做【'+QueryCodeName(uptype,'uptype')+'】!'),'恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
          close;
          exit;
        end;
        li_manid:=fieldbyname('manid').AsInteger;
        ls_status:=fieldbyname('status').AsString;
        ls_agcardno:=fieldbyname('agcardno').AsString;
        ls_psname:=fieldbyname('psname').AsString;
        ls_sex:=fieldbyname('sex').AsString;
        li_organid:=fieldbyname('organid').AsInteger;
        lr_rewage:=fieldbyname('rewage').AsFloat;

        ls_sql:='select upreason,cgdate,oristatus,lockflg,notes,cpseno,organid,oricpseno,oriorganid,itcode,uptype from psupcase where manid='+inttostr(li_manid)+' and procflg='+#39+'1'+#39;
        close;
        sql.Clear;
        sql.Add(ls_sql);
        prepare;
        open;
        if RecordCount>0 then
        begin
          if fieldbyname('lockflg').AsString='1' then
          begin
            application.MessageBox('此人已经存在变动业务,而且业务已经被锁定!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
            close;
            exit;
          end;
          
          ls_status:=fieldbyname('oristatus').AsString;
          ls_upreason:=fieldbyname('upreason').AsString;
          ls_cgdate:=fieldbyname('cgdate').AsString;
          ls_notes:=fieldbyname('notes').AsString;
          li_cpseno:=fieldbyname('cpseno').AsInteger;
          li_organid:=fieldbyname('organid').AsInteger;
          li_oricpseno:=fieldbyname('oricpseno').AsInteger;
          li_oriorganid:=fieldbyname('oriorganid').AsInteger;
          li_itcode:=fieldbyname('itcode').AsInteger;
          ls_oriuptype:=fieldbyname('uptype').AsString;

          close;
          //ls_upreasonname:=QueryName('upname','upreason','upcode='+#39+ls_upreason+#39);
          if not UptypeCanDo(ls_status,uptype) then
          begin
            application.MessageBox(pchar('此人已经存在变动业务,而且变动前状态为【'+QueryCodeName(ls_status,'status')+'】,不能做【'+QueryCodeName(uptype,'uptype')+'】!'),'恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
            exit;
          end else
          begin
            if ls_oriuptype=uptype then
            begin
              if application.MessageBox(pchar('此人已经存在【'+QueryCodeName(ls_oriuptype,'uptype')+'】业务,是否要修改该业务?'),'恩普软件',MB_YESNO+MB_IconQuestion+MB_DEFBUTTON2+MB_SystemModal)=IDNO then
                exit;
            end else
            begin
              if application.MessageBox(pchar('此人已经存在【'+QueryCodeName(ls_oriuptype,'uptype')+'】业务,且与当前选择的变动类型不一致,如果继续将删除已存在的变动业务,是否继续?'),'恩普软件',MB_YESNO+MB_IconQuestion+MB_DEFBUTTON2+MB_SystemModal)=IDNO then
                exit;
            end;

            fcTC_loctran_oriorgan.Items.Clear;
            Init_CompOrgan(fcTC_loctran_oriorgan);
            fcTC_loctran_oriorgan.SetSelectedNode(fcTC_loctran_oriorgan.Items.FindNode(QueryName('name','organization','id='+inttostr(li_oriorganid)),false));
            if fcTC_loctran_oriorgan.SelectedNode<>nil then
              fcTC_loctran_oriorgan.Text:=fcTC_loctran_oriorgan.SelectedNode.Text
            else
              fcTC_loctran_oriorgan.Text:='';
            fcTC_loctran_neworgan.Items.Clear;
            Init_CompOrgan(fcTC_loctran_neworgan);
            fcTC_loctran_neworgan.SetSelectedNode(fcTC_loctran_neworgan.Items.FindNode(QueryName('name','organization','id='+inttostr(li_organid)),false));
            if fcTC_loctran_neworgan.SelectedNode<>nil then
            begin
              fcTC_loctran_neworgan.Text:=fcTC_loctran_neworgan.SelectedNode.Text;
              fcTC_loctran_upreason.Enabled:=true;
              DE_loctran_cgdate.Enabled:=true;
              fcTC_loctran_itcode.Enabled:=true;
              E_loctran_rewage.Enabled:=true;
              M_loctran_notes.Enabled:=true;
            end else
            begin
              fcTC_loctran_neworgan.Text:='';
              fcTC_loctran_upreason.Enabled:=false;
              DE_loctran_cgdate.Enabled:=false;
              fcTC_loctran_itcode.Enabled:=false;
              E_loctran_rewage.Enabled:=false;
              M_loctran_notes.Enabled:=false;
            end;
            fcTC_loctran_upreason.Items.Clear;
            Init_CompReaslist('uptype='+#39+uptype+#39,fcTC_loctran_upreason);
            fcTC_loctran_upreason.SetSelectedNode(fcTC_loctran_upreason.Items.FindNode(QueryName('upname','upreason','upcode='+#39+ls_upreason+#39),true));
            if fcTC_loctran_upreason.SelectedNode<>nil then
              fcTC_loctran_upreason.Text:=fcTC_loctran_upreason.SelectedNode.Text
            else
              fcTC_loctran_upreason.Text:='';
            DE_loctran_cgdate.Text:=ls_cgdate;
            M_loctran_notes.Text:=ls_notes;
            fcTc_loctran_itcode.Items.Clear;
            Init_Compitlist(fcTc_loctran_itcode,'');
            fcTc_loctran_itcode.SetSelectedNode(fcTc_loctran_itcode.Items.FindNode(QueryName('itname','pycode','itcode='+inttostr(li_itcode)),true));
            if fcTc_loctran_itcode.SelectedNode<>nil then
              fcTc_loctran_itcode.Text:=fcTc_loctran_itcode.SelectedNode.Text
            else
              fcTc_loctran_itcode.Text:='';
          end;
        end else
        begin
          fcTC_loctran_oriorgan.Items.Clear;
          Init_CompOrgan(fcTC_loctran_oriorgan);
          fcTC_loctran_oriorgan.SetSelectedNode(fcTC_loctran_oriorgan.Items.FindNode(QueryName('name','organization','id='+inttostr(li_organid)),false));
          if fcTC_loctran_oriorgan.SelectedNode<>nil then
            fcTC_loctran_oriorgan.Text:=fcTC_loctran_oriorgan.SelectedNode.Text
          else
            fcTC_loctran_oriorgan.Text:='';
          fcTC_loctran_neworgan.Items.Clear;
          Init_CompOrgan(fcTC_loctran_neworgan);
          fcTC_loctran_neworgan.Text:='';

          fcTC_loctran_upreason.Items.Clear;
          Init_CompReaslist('uptype='+#39+uptype+#39,fcTC_loctran_upreason);
          fcTC_loctran_upreason.Text:='';
          DE_loctran_cgdate.Text:=FormatDateTime('yyyy-mm-dd',today);
          M_loctran_notes.Text:='';
          fcTc_loctran_itcode.Items.Clear;
          Init_Compitlist(fcTc_loctran_itcode,'');
          fcTc_loctran_itcode.Text:='';

          fcTC_loctran_upreason.Enabled:=false;
          DE_loctran_cgdate.Enabled:=false;
          fcTC_loctran_itcode.Enabled:=false;
          E_loctran_rewage.Enabled:=false;
          M_loctran_notes.Enabled:=false;
        end;

        if not UptypeCanDo(ls_status,uptype) then
        begin
          application.MessageBox(pchar('此人状态为【'+QueryCodeName(ls_status,'status')+'】,不能做【'+QueryCodeName(uptype,'uptype')+'】!'),'恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
          exit;
        end;

        E_loctran_iscode.Text:=iscode;
        E_loctran_agcardno.Text:=ls_agcardno;
        E_loctran_psname.Text:=ls_psname;
        E_loctran_sex.Text:=QueryCodeName(ls_sex,'sex');
        E_loctran_rewage.Text:=floattostr(lr_rewage);
        TC_loctran.Tabs.Strings[0]:=QueryCodeName(uptype,'uptype');
        TC_loctran.Visible:=true;
        TC_new.Visible:=false;
        TC_othchg.Visible:=false;
      end;
    end;

    FB_previous.Enabled:=true;
    FB_next.Enabled:=true;
    pagecontrol1.ActivePageIndex:=1;
  //////////////////////
  end else
  if pagecontrol1.ActivePageIndex=1 then
  begin
    if (uptype='01') or (uptype='02') or (uptype='03') then
    begin
      if not NewCheck() then
        exit;
      {if fcTC_new_organ.SelectedNode=nil then
      begin
        application.MessageBox('请选择单位或部门!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
        exit;
      end;
      if fcTC_new_sex.SelectedNode=nil then
      begin
        application.MessageBox('请选择性别!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
        exit;
      end;
      if fcTC_new_identity.SelectedNode=nil then
      begin
        application.MessageBox('请选择身份!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
        exit;
      end;
      if fcTC_new_household.SelectedNode=nil then
      begin
        application.MessageBox('请选择户籍关系!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
        exit;
      end;
      if fcTC_new_wkattr.SelectedNode=nil then
      begin
        application.MessageBox('请选择用工性质!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
        exit;
      end;
      if fcTC_new_upreason.SelectedNode=nil then
      begin
        application.MessageBox('请选择参保原因!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
        exit;
      end;
      if fcTC_new_itcode.SelectedNode=nil then
      begin
        application.MessageBox('请选择补缴档次!','恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
        exit;
      end;}
      li_organid:=strtoint(fcTC_new_organ.SelectedNode.StringData);
      li_cpseno:=GetOrganCpseno(query1,li_organid);
      ls_psname:=trim(E_new_psname.Text);
      ls_bdate:=trim(DE_new_bdate.Text);
      ls_sex:=fcTC_new_sex.SelectedNode.StringData;
      ls_identity:=fcTC_new_identity.SelectedNode.StringData;
      ls_household:=fcTC_new_household.SelectedNode.StringData;
      ls_wkdate:=trim(DE_new_wkdate.Text);
      ls_wkattr:=fcTC_new_wkattr.SelectedNode.StringData;
      ls_joindate:=trim(DE_new_joindate.Text);
      ls_cgdate:=trim(DE_new_cgdate.Text);
      lr_rewage:=strtofloat(E_new_rewage.Text);
      lr_bfidyears:=strtofloat(E_new_bfidyears.Text);
      ls_upreason:=fcTC_new_upreason.SelectedNode.StringData;
      li_itcode:=strtoint(fcTC_new_itcode.SelectedNode.StringData);
      ls_notes:=trim(M_new_notes.Text);

      datashare_form.Dbs.StartTransaction;
      try
        with datashare_form.Query1 do
        begin
          ls_sql:='select manid,agcardno,psseno,status from psarch where trim(iscode)='+#39+iscode+#39;
          close;
          sql.Clear;
          sql.Add(ls_sql);
          prepare;
          open;
          if RecordCount=0 then
          begin
            ls_sql:='insert into psarch(psseno,cpseno,iscode,agcardno,psname,sex,bdate,household,wkattr,identity,pflg,wkdate,joindate,status,rewage,bfidyears,chgreason,chantime,chaninfo,itcode,ifmodify,lockflg,organid) ';
            ls_sql:=ls_sql+'values(-1,'+inttostr(li_cpseno)+','+#39+iscode+#39+','+#39+''+#39+','+#39+ls_psname+#39+','+#39+ls_sex+#39+','+#39+ls_bdate+#39+','+#39+ls_household+#39+','+#39+ls_wkattr+#39+','+#39+ls_identity+#39+','+#39+'0'+#39;
            ls_sql:=ls_sql+','+#39+ls_wkdate+#39+','+#39+ls_joindate+#39+','+#39+'1'+#39+','+floattostr(lr_rewage)+','+floattostr(lr_bfidyears)+','+#39+ls_upreason+#39+','+#39+ls_cgdate+#39+','+#39+ls_notes+#39+','+inttostr(li_itcode)+','+#39+'6'+#39+','+#39+'0'+#39+','+inttostr(li_organid)+')';
            close;
            sql.Clear;
            sql.Add(ls_sql);
            Execsql;

            close;
            sql.Clear;
            sql.Add('select manid from psarch where trim(iscode)='+#39+iscode+#39);
            prepare;
            open;
            li_manid:=fieldbyname('manid').AsInteger;
            close;
            ls_agcardno:='';
            li_psseno:=-1;
            ls_status:='0';
          end else
          begin
            li_manid:=fieldbyname('manid').AsInteger;
            ls_agcardno:=fieldbyname('agcardno').AsString;
            li_psseno:=fieldbyname('psseno').AsInteger;
            ls_status:=fieldbyname('status').AsString;
            ls_sql:='update psarch set cpseno='+inttostr(li_cpseno)+',psname='+#39+ls_psname+#39+',sex='+#39+ls_sex+#39+',bdate='+#39+ls_bdate+#39+',household='+#39+ls_household+#39+',wkattr='+#39+ls_wkattr+#39;
            ls_sql:=ls_sql+',identity='+#39+ls_identity+#39+',wkdate='+#39+ls_wkdate+#39+',joindate='+#39+ls_joindate+#39+',status='+#39+'1'+#39+',rewage='+floattostr(lr_rewage)+',bfidyears='+floattostr(lr_bfidyears);
            ls_sql:=ls_sql+',chgreason='+#39+ls_upreason+#39+',chantime='+#39+ls_cgdate+#39+',chaninfo='+#39+ls_notes+#39+',itcode='+inttostr(li_itcode)+',organid='+inttostr(li_organid)+' where manid='+inttostr(li_manid);
            close;
            sql.Clear;
            sql.Add(ls_sql);
            Execsql;
            close;
          end;

          ls_sql:='select opid from psupcase where manid='+inttostr(li_manid)+' and procflg='+#39+'1'+#39;
          close;
          sql.Clear;
          sql.Add(ls_sql);
          prepare;
          open;
          if RecordCount=0 then
          begin
            close;    //取得最大的opid
            sql.clear;
            ls_sql:='select max(opid) opid from psupcase';
            sql.add(ls_sql);
            prepare;
            open;
            li_opid:=fieldbyname('opid').AsInteger+1;

            ls_sql:='insert into psupcase(iscode,psname,agcardno,uptype,opid,upreason,cgdate,oristatus,opcode,opdate,procflg,notes,manid,psseno,cpseno,itcode,opname) ';
            ls_sql:=ls_sql+'values('+#39+iscode+#39+','+#39+ls_psname+#39+','+#39+ls_agcardno+#39+','+#39+uptype+#39+','+inttostr(li_opid)+','+#39+ls_upreason+#39+','+#39+ls_cgdate+#39+','+#39+ls_status+#39;
            ls_sql:=ls_sql+','+inttostr(main_form.user.OPERID)+',today(),'+#39+'1'+#39+','+#39+ls_notes+#39+','+inttostr(li_manid)+','+inttostr(li_psseno)+','+inttostr(li_cpseno)+','+inttostr(li_itcode)+','+#39+main_form.user.OPNAME+#39+')';
            close;
            sql.Clear;
            sql.Add(ls_sql);
            Execsql;
          end else
          begin
            li_opid:=fieldbyname('opid').AsInteger;
            ls_sql:='update psupcase set iscode='+#39+iscode+#39+',uptype='+#39+uptype+#39+',upreason='+#39+ls_upreason+#39+',cgdate='+#39+ls_cgdate+#39+',opcode='+inttostr(main_form.user.OPERID)+',opdate=today()';
            ls_sql:=ls_sql+',procflg='+#39+'1'+#39+',notes='+#39+ls_notes+#39+',psseno='+inttostr(li_manid)+',cpseno='+inttostr(li_cpseno)+',organid=null,oricpseno=null,oriorganid=null,itcode='+inttostr(li_itcode);
            ls_sql:=ls_sql+',psname='+#39+ls_psname+#39+',agcardno='+#39+ls_agcardno+#39+',opname='+#39+main_form.user.OPNAME+#39+' where manid='+inttostr(li_manid)+' and procflg='+#39+'1'+#39;
            close;
            sql.Clear;
            sql.Add(ls_sql);
            Execsql;
          end;
        end;
        datashare_form.Dbs.Commit;
      except
        on e:exception do
        begin
          datashare_form.Dbs.Rollback;
          application.MessageBox(pchar(e.Message),'恩普软件',MB_OK+MB_IconInformation+MB_SystemModal);
          exit;
        end;
      end;

    end else

⌨️ 快捷键说明

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