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

📄 yszmcxdlg.cpp

📁 这是一套学校设备管理系统的源码 里面有树形结构使用的很棒的方法
💻 CPP
📖 第 1 页 / 共 5 页
字号:
			r = atoi(rkr);
			g_rksj[end_result_recs] = n*10000+y*100+r;
			strcpy(buf,rkn);
			strcat(buf,"年");
			strcat(buf,rky);
			strcat(buf,"月");
			strcat(buf,rkr);
			strcat(buf,"日");
			strcpy(g_buf[5][end_result_recs],buf);
			strcpy(g_buf[6][end_result_recs],xhgg);
			strcpy(g_buf[7][end_result_recs],jbr);
			strcpy(g_buf[8][end_result_recs],gdbh);
			strcpy(g_buf[9][end_result_recs],sfdzp);
			strcpy(g_buf[10][end_result_recs],cjpp);
			strcpy(g_buf[11][end_result_recs],ghdw);
			strcpy(g_buf[12][end_result_recs],ssbm);
			strcpy(g_buf[13][end_result_recs],rkfs);
            end_result_recs ++;
          }
    } 
	sprintf(buf,"%10.2lf",tjzsl);
	SetDlgItemText(IDC_tjzsl,buf);
	sprintf(buf,"%10.2lf",tjzje);
	SetDlgItemText(IDC_tjzje,buf);
	sprintf(buf,"%10.2lf",tjxxhf);
	SetDlgItemText(IDC_tjxxhf,buf);
	sprintf(buf,"%10.2lf",tjsjhf);
	SetDlgItemText(IDC_tjsjhf,buf);
	if (fpe != NULL)
	  fclose(fpe);
    show_result();
	free_sbtree(m_tree);
	load_sbtree(m_tree);
	SetDlgItemText(IDC_sbs,buf11);

}

void yszmcx_clear_read_data()
{
	int t;

		  if (jfxs[0] == '~'){
			  jfxs[0] = 0;
		  }
		  if (yzf[0] == '~'){
			  yzf[0] = 0;
		  }
		  if (kcbh[0] == '~'){
			  kcbh[0] = 0;
		  }
		  else{
              t = atoi(kcbh);
			  itoa(t,kcbh,10);
          }
		  if (pyjx[0] == '~'){
			  pyjx[0] = 0;
		  }
		  if (gdbh[0] == '~'){
			  gdbh[0] = 0;
		  }
		  if (yqdm[0] == '~'){
			  yqdm[0] = 0;
		  }
		  if (sbmc[0] == '~'){
			  sbmc[0] = 0;
		  }
		  if (scdm[0] == '~'){
			  scdm[0] = 0;
		  }
		  if (cjpp[0] == '~'){
			  cjpp[0] = 0;
		  }
		  if (xhgg[0] == '~'){
			  xhgg[0] = 0;
		  }
		  if (wpdj[0] == '~'){
			  wpdj[0] = 0;
		  }
		  if (wpsl[0] == '~'){
			  wpsl[0] = 0;
		  }
		  if (zje[0] == '~'){
			  zje[0] = 0;
		  }
		  if (rkfs[0] == '~'){
			  rkfs[0] = 0;
		  }
		  if (sfdzp[0] == '~'){
			  sfdzp[0] = 0;
		  }
		  if (ssbm[0] == '~'){
			  ssbm[0] = 0;
		  }
		  if (jbr[0] == '~'){
			  jbr[0] = 0;
		  }
		  if (ghdw[0] == '~'){
			  ghdw[0] = 0;
		  }
		  if (rkn[0] == '~'){
			  rkn[0] = 0;
		  }
		  if (rky[0] == '~'){
			  rky[0] = 0;
		  }
		  if (rkr[0] == '~'){
			  rkr[0] = 0;
		  }
}

BOOL yszmcx_if_valid(Cyszmcxdlg *dlg)
{
  int num,i,j;
  long bl,el,l;
  float bf,ef,f;
  int t_rkn,t_rky,t_rkr,t_qsrkn,t_qsrky,t_qsrkr,t_jsrkn,t_jsrky,t_jsrkr;
  char buf[100],buf1[100];
  char *pstr,*pstr1,buf11[50];
  int flag,b_flag;
  
  num = 0;
  if (s_qrksj_flag == 1)
	  num ++;
  if (s_jrksj_flag == 1)
	  num ++;
  if (s_sbs_flag == 1)
	  num ++;
  if (s_sbmc_flag == 1)
	  num ++;
  if (s_qrkbh_flag == 1)
	  num ++;
  if (s_jrkbh_flag == 1)
	  num ++;
  if (s_ssbm_flag == 1)
	  num ++;
  if (s_dzp_flag == 1)
	  num ++;
  if (s_jbr_flag == 1)
	  num ++;
  if (s_rkfs_flag == 1)
	  num ++;
  if (s_qgdbh_flag == 1)
	  num ++;
  if (s_jgdbh_flag == 1)
	  num ++;
  if (s_qwpdj_flag == 1)
	  num ++;
  if (s_jwpdj_flag == 1)
	  num ++;
  if (num == 0)
    return TRUE;
  if (s_qrksj_flag == 1){
      t_rkn = atoi(rkn);
	  t_rky = atoi(rky);
	  t_rkr = atoi(rkr);
      t_qsrkn = atoi(g_yszmcx_qsrksjn);
	  t_qsrky = atoi(g_yszmcx_qsrksjy);
	  t_qsrkr = atoi(g_yszmcx_qsrksjr);
      l = t_rkn*10000L + t_rky*100L + t_rkr;
	  bl = t_qsrkn*10000L + t_qsrky*100L + t_qsrkr;
	  if (bl != 0L){
		  if (l < bl)
			  return FALSE;
      }
  }
  if (s_jrksj_flag == 1){
      t_rkn = atoi(rkn);
	  t_rky = atoi(rky);
	  t_rkr = atoi(rkr);
      t_jsrkn = atoi(g_yszmcx_jsrksjn);
	  t_jsrky = atoi(g_yszmcx_jsrksjy);
	  t_jsrkr = atoi(g_yszmcx_jsrksjr);
      l = t_rkn*10000L + t_rky*100L + t_rkr;
	  el = t_jsrkn*10000L + t_jsrky*100L + t_jsrkr;
	  if (el != 0L){
		  if (l > el)
			  return FALSE;
      }
  }
  if (s_sbs_flag == 1){
    strcpy(buf,s_sbs);
	buf[6] = 0;
    j = strlen(buf);
	if (j > 0)
	  j --;
	while (buf[j] == ' '){
		buf[j] = 0;
		j --;
		if (j == 0)
			break;
    }
	if ((buf[4] == '0')&&(buf[5] == '0')){
		buf[4] = 0;
		if (buf[3] == '0'){
		  buf[3] = 0;
	      if ((buf[1] == '0')&&(buf[2] == '0'))
		    buf[1] = 0;
        }  
    }
    strcpy(buf1,gdbh);
    j = strlen(buf1);
	if (j > 0)
	  j --;
	while (buf1[j] == ' '){
		buf1[j] = 0;
		j --;
		if (j == 0)
			break;
    }
	while (buf1[j] == '0'){
		buf1[j] = 0;
		j --;
		if (j == 0)
			break;
    }
    
	if (strlen(buf) > strlen(buf1)){
		return FALSE;
	}
	else{
		buf1[strlen(buf)] = 0;
		if (strcmp(buf1,buf) != 0)
			return FALSE;
    }
	if (strlen(buf) == 6){
      if ((strstr(s_sbs,"其他") == NULL)&&
		  (strstr(s_sbs,"其它") == NULL)){
        strcpy(buf11,&(s_sbs[8]));
	    if (strstr(sbmc,buf11) == NULL){
	      return FALSE;
		}
	  }
	}
  }
  if (s_sbmc_flag == 1){
	  if (strstr(sbmc,s_sbmc) == NULL){
	    return FALSE;
      }
	  else{
        pstr = strstr(sbmc,s_sbmc);
		i = 0;
		pstr1 = sbmc;
		while (pstr != pstr1){
			i ++;
			pstr1 ++;
        }
		b_flag = 1;
		for (j=0;j<i;j++){
			if ((unsigned char)(sbmc[j]) > 127){
				if (b_flag == 1)
					b_flag = 0;
				else
					b_flag = 1;
            }
			else
				b_flag = 1;
        }
		if (b_flag == 0)
			return FALSE;
      }
  }
  if (s_qrkbh_flag == 1){
      l = atol(kcbh);
	  bl = atol(s_qrkbh);
	  if (bl != 0L){
	    if (l < bl)
          return FALSE;
      }
  }
  if (s_jrkbh_flag == 1){
      l = atol(kcbh);
	  el = atol(s_jrkbh);
	  if (el != 0L){
	    if (l > el)
          return FALSE;
      }
  }
  if (s_ssbm_flag){
	  if (strcmp(s_ssbm,ssbm) != 0){
	    return FALSE;
      }
  }
  if (s_dzp_flag){
	  if (strcmp(s_dzp,"否") == 0){
		  if (gdbh[3] == '2')
			  return FALSE;
      }
	  else{
		  if (gdbh[3] != '2')
			  return FALSE;
      }
  }
  if (s_jbr_flag){
	  if (strcmp(s_jbr,jbr) != 0){
	    return FALSE;
      }
  }
  if (s_rkfs_flag){
	  if (strcmp(s_rkfs,rkfs) != 0){
	    return FALSE;
      }
  }
  if (s_qgdbh_flag){
      l = atol(gdbh);
	  bl = atol(s_qgdbh);
	  if (bl != 0L){
		  if (l < bl)
			  return FALSE;
      }
  }
  if (s_jgdbh_flag){
      l = atol(gdbh);
	  el = atol(s_jgdbh);
	  if (el != 0L){
		  if (l > el)
			  return FALSE;
      }
  }
  if (s_qwpdj_flag){
      f = atof(wpdj);
	  bf = atof(s_qwpdj);
	  if (bf != 0L){
		  if (f < bf)
			  return FALSE;
      }
  }
  if (s_jwpdj_flag){
      f = atof(wpdj);
	  ef = atof(s_jwpdj);
	  if (ef != 0L){
		  if (f > ef)
			  return FALSE;
      }
  }

  return TRUE;
}


void Cyszmcxdlg::Onshanchu() 
{
	long rowl;
    int i,num,n;
	long l;
	char buf[12],buf1[12];
	char bu[500];
	
    FILE *fpe;

    if ((sfjslsk_flag == 1)||(sfjqck_flag == 1)){
		MessageBox("此种模式下不能删除纪录.","",MB_OK);
		return;
    }
    if (g_yszm_flag == 1){
	  fpe = fopen("c:\\xxsbgl\\yszmfz.set","r");
	  if (fpe != NULL){
		fclose(fpe);
		MessageBox("对不起,原始帐目已封帐,不能更改.","",MB_OK);
		return;
	  }
	}
	if (g_lishi_flag == 1)
		return;
	num = 0;
	l = m_result.GetRowSel();
	if ((l  > end_result_recs)||(l < 1)){
		MessageBox("您没有选择要删除的纪录.","",MB_OK);
		return ;
    }
	str = m_result.GetClip();
	int flag;
	flag = 0;
    for (i=0;i<str.GetLength();i++){
		if (str[i] == 9){
			flag = 1;
		    break;
		}
    }
	if (flag == 0){
		MessageBox("您没有选择要删除的纪录.","",MB_OK);
		return ;
    }
    for (i=0;i<str.GetLength();i++){
		if (str[i] == 13)
			num ++;
    }
	if (num > 1){
		if (!IsDlgButtonChecked(IDC_arkbhpx)){
			MessageBox("对不起,该种删除办法只能在按入库编号排序时使用.","",MB_OK);
			return;
        }
    }
	if (num > 999){
		MessageBox("对不起,不能一次删除一千条以上的纪录,请少选一些.","",MB_OK);
		return ;
    }
    
	int j = 0;
	while (str[j] != 9){
		buf[j] = str[j];
		j ++;
    }
    buf[j] = 0;
    
    Cyszmscqrdlg dlg;

	if (dlg.DoModal() == IDOK){
	for (i=1;i<end_result_recs+1;i++){
	  l = i;
	  str = m_result.GetTextMatrix(l,0L);;
      strcpy(buf1,str.GetBuffer(12));
	  if (strcmp(buf1,buf) == 0){
		  n = i;
		  break;
      }
    }
    
    FILE *fpe,*tofpe;
	long b_pos;
	int num_of_recs;

	if (g_yszm_flag == 1){
	  fpe = fopen("c:\\xxsbgl\\yszm.dat","rb");
	}
	else{
	  fpe = fopen("c:\\xxsbgl\\sbrkzm.dat","rb");
    }
    tofpe = fopen("c:\\xxsbgl\\temp.dat","wb");
	fseek(fpe,0L,SEEK_END);
	l = ftell(fpe);
	fseek(fpe,0L,SEEK_SET);
	num_of_recs = l / 453;
    n --;
	n = order_of_result_recs[duiyin_tab[n]];
    b_pos = n * 453L;
    for (i=0;i<n;i++){
		fread(bu,1,453,fpe);
		fwrite(bu,1,453,tofpe);
    }
	l = (n+num+1)*453;
	fseek(fpe,l,SEEK_SET);
	for (i=n+num+1;i<num_of_recs;i++){
		fread(bu,1,453,fpe);
		fwrite(bu,1,453,tofpe);
    }
    fclose(fpe);
	fclose(tofpe);

    fpe = fopen("c:\\xxsbgl\\temp.dat","rb");
	if (g_yszm_flag == 1){
	  tofpe = fopen("c:\\xxsbgl\\yszm.dat","wb");
	}
	else{
	  tofpe = fopen("c:\\xxsbgl\\sbrkzm.dat","wb");
    }
	fseek(fpe,0L,SEEK_END);
	l = ftell(fpe);
	fseek(fpe,0L,SEEK_SET);
	num_of_recs = l / 453;
	for (i=0;i<num_of_recs;i++){
		fread(bu,1,453,fpe);
		fwrite(bu,1,453,tofpe);
    }
    fclose(fpe);
	fclose(tofpe);
	Onchaxun();
	}
}

void Cyszmcxdlg::Onxiugai() 
{
	// TODO: Add your control notification handler code here
	long rowl;
	FILE *fpe;
	long l;
	int num,i,ret;
	char bu[500],buf[100];
	CString str;

	if (g_zm_chaxun_flag != YSZM)
		return;
    
    if (g_yszm_flag == 1){
      fpe = fopen("c:\\xxsbgl\\yszmfz.set","r");
	  if (fpe != NULL){
		fclose(fpe);
		MessageBox("对不起,原始帐目已封帐,不能更改.","",MB_OK);
		return;
	  }
	}

	if (g_lishi_flag == 1)
		return;
	rowl = m_result.GetRowSel();
	if (rowl > 0L){
		if (rowl < end_result_recs+1){
          g_yszm_mod_rec = duiyin_tab[rowl - 1];
		  m_result.SetRow(rowl);
		  m_result.SetCol(8L);
		  str = m_result.GetText();
		  strcpy(buf,str.GetBuffer(10));
		  if (strlen(buf) != 6)
			  return ;
		  Cyszmxgdlg dlg;
		  dlg.DoModal();

	      if (g_yszm_flag == 1){
	        fpe = fopen("c:\\xxsbgl\\yszm.dat","rb");
		  }
	      else{
	        fpe = fopen("c:\\xxsbgl\\sbrkzm.dat","rb");
		  }
	      if (fpe != NULL){
		    fseek(fpe,0L,SEEK_END);
		    l = ftell(fpe);
		    num = l/453;
		    l = order_of_result_recs[g_yszm_mod_rec] * 453L;
		    fseek(fpe,l,SEEK_SET);
            fread(&(tzm.reserve[0]),sizeof(zmstrt),1,fpe);
		    strcpy(jfxs,tzm.jfxs);
		    strcpy(yzf,tzm.yzf);
		    strcpy(kcbh,tzm.rkbh);
		    strcpy(pyjx,tzm.pyjx);
		    strcpy(gdbh,tzm.gdbh);
		    strcpy(yqdm,tzm.yqdm);
		    strcpy(sbmc,tzm.sbmc);
		    strcpy(scdm,tzm.scdm);
		    strcpy(cjpp,tzm.cjpp);
		    strcpy(xhgg,tzm.xhgg);
		    strcpy(wpdj,tzm.wpdj);
		    strcpy(wpsl,tzm.wpsl);

⌨️ 快捷键说明

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