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

📄 yszmcxdlg.cpp

📁 这是一套学校设备管理系统的源码 里面有树形结构使用的很棒的方法
💻 CPP
📖 第 1 页 / 共 5 页
字号:

      fprintf(tofpe,"endpage\r\n");
  }
  fclose(fpe);
  fclose(tofpe);

  fpe = fopen("c:\\prtset.txt","wb");
  fprintf(fpe,"2100\n");
  fprintf(fpe,"2970\n");
  fprintf(fpe,"2\n");
  fclose(fpe);

  _spawnl(_P_WAIT,"c:\\xxsbgl\\prt.exe","c:\\xxsbgl\\prt.exe",NULL);

}

void Cyszmcxdlg::OnKeyDownresult(short FAR* KeyCode, short Shift) 
{
	// TODO: Add your control notification handler code here
	if (*KeyCode == 112){
		Onchaxun();
    }
//	if (*KeyCode == 113){
//		Onxiugai();
//    }
//	if (*KeyCode == 114){
//		Onshanchu();
//    }
	if (*KeyCode == 115){
		Ondayin();
    }
	if (*KeyCode == 116){
		OnCancel();
    }	
}

void Cyszmcxdlg::OnKeyDowncond(short FAR* KeyCode, short Shift) 
{
	// TODO: Add your control notification handler code here
	if (*KeyCode == 112){
		Onchaxun();
    }
//	if (*KeyCode == 113){
//		Onxiugai();
//    }
//	if (*KeyCode == 114){
//		Onshanchu();
//    }
	if (*KeyCode == 115){
		Ondayin();
    }
	if (*KeyCode == 116){
		OnCancel();
    }
}

	

void Cyszmcxdlg::Onarkbhpx() 
{
	// TODO: Add your control notification handler code here
	CheckDlgButton(IDC_arkbhpx,TRUE);
	CheckDlgButton(IDC_asbmcpx,FALSE);
	CheckDlgButton(IDC_arksjpx,FALSE);
	CheckDlgButton(IDC_agdbhpx,FALSE);

	int i;

    for (i=0;i<4000;i++)
		duiyin_tab[i] = i;
	
	show_result();
}

void Cyszmcxdlg::Onarksjpx() 
{
	// TODO: Add your control notification handler code here
	CheckDlgButton(IDC_arkbhpx,FALSE);
	CheckDlgButton(IDC_asbmcpx,FALSE);
	CheckDlgButton(IDC_arksjpx,TRUE);
	CheckDlgButton(IDC_agdbhpx,FALSE);
	
	int i,j,k;
	long min;

	for (i=0;i<4000;i++)
		g_processed[i] = 0;
	for (i=0;i<end_result_recs;i++){
	    min = 25000000L;
        for (j=0;j<end_result_recs;j++){
			if (g_processed[j] == 0){
				if (g_rksj[j] < min){
					min = g_rksj[j];
					k = j;
                }
            }
        }
		g_processed[k] = 1;
		duiyin_tab[i] = k;
    }
    	
	show_result();
}

void Cyszmcxdlg::Onasbmcpx() 
{
	// TODO: Add your control notification handler code here
	CheckDlgButton(IDC_arkbhpx,FALSE);
	CheckDlgButton(IDC_asbmcpx,TRUE);
	CheckDlgButton(IDC_arksjpx,FALSE);
	CheckDlgButton(IDC_agdbhpx,FALSE);
	
	int i,j,k;
	char bu[50];

	for (i=0;i<4000;i++)
		g_processed[i] = 0;
	for (i=0;i<end_result_recs;i++){
		bu[0] = 255;
		bu[1] = 0;
        for (j=0;j<end_result_recs;j++){
			if (g_processed[j] == 0){
				if (strcmp(g_buf[1][j],bu) < 0){
					strcpy(bu,g_buf[1][j]);
					k = j;
                }
            }
        }
		g_processed[k] = 1;
		duiyin_tab[i] = k;
    }
    	
	show_result();
}

void Cyszmcxdlg::Onagdbhpx() 
{
	// TODO: Add your control notification handler code here
	CheckDlgButton(IDC_arkbhpx,FALSE);
	CheckDlgButton(IDC_asbmcpx,FALSE);
	CheckDlgButton(IDC_arksjpx,FALSE);
	CheckDlgButton(IDC_agdbhpx,TRUE);
	
	int i,j,k;
	long min,l;

	for (i=0;i<4000;i++)
		g_processed[i] = 0;
	for (i=0;i<end_result_recs;i++){
	    min = 25000000L;
        for (j=0;j<end_result_recs;j++){
			if (g_processed[j] == 0){
				l = atol(g_buf[8][j]);
				if (l < min){
					min = l;
					k = j;
                }
            }
        }
		g_processed[k] = 1;
		duiyin_tab[i] = k;
    }
    	
	show_result();
}

void Cyszmcxdlg::show_result()
{
	int i;
	long l,col;

	l = end_result_recs + 1;
	if (l != 1){
	  m_result.SetRows(l);
	  for (i=0;i<end_result_recs;i++){
        l = i + 1;
	    m_result.SetRow(l);
	    for (col=0;col<14;col++){
	      m_result.SetCol(col);
	      m_result.SetText(g_buf[col][duiyin_tab[i]]);
		}
	  }
	}
	else{
	  m_result.SetRows(2L);
	  m_result.SetRow(1L);
	  for (l=0;l<=13;l++){
	    m_result.SetCol(l);
	    m_result.SetText("");
	  }
    }
}


void yield_cur_zm()
{
	FILE *fpe,*tofpe;
	long l;
	int num,i,j,k,t;
	char bu[500];
	char buf[100];
	float tjzje,tjzsl;
	double f,f1,f2,f3,sl,sl1;
	int jqck_flag,bh,bh1,num1;
	FILE *cfpe,*qfpe;
	int jslsk_flag,n,y,r;

	jslsk_flag = 1;
    cfpe = fopen("c:\\xxsbgl\\sbckzm.dat","rb");
	if (cfpe == NULL){
	  end_of_sbck_recs = 0;
	}
	else{
	    fseek(cfpe,0L,SEEK_END);
	    l = ftell(cfpe);
	    num = l/280;
	    fseek(cfpe,0L,SEEK_SET);
        for (i=0;i<num;i++){
		  fread(&(sbckunit.reserve[0]),sizeof(sbckstrt),1,cfpe);
		  strcpy(ckbh,sbckunit.ckbh);
		  strcpy(wpdj,sbckunit.wpdj);
		  strcpy(sbmc,sbckunit.sbmc);
		  strcpy(cksl,sbckunit.cksl);
		  strcpy(ckfs,sbckunit.ckfs);
		  strcpy(zje,sbckunit.zje);
		  strcpy(ckn,sbckunit.ckn);
		  strcpy(cky,sbckunit.cky);
		  strcpy(ckr,sbckunit.ckr);
		  strcpy(jbr,sbckunit.jbr);
		  strcpy(yqdm,sbckunit.yqdm);
		  strcpy(ssbm,sbckunit.ssbm);
		  strcpy(gdbh,sbckunit.gdbh);
		  strcpy(pyjx,sbckunit.pyjx);
		  strcpy(ckfx,sbckunit.ckfx);
		  strcpy(rkbh,sbckunit.rkbh);

          strcpy(sbck_ckbh[i],ckbh);        
          strcpy(sbck_wpdj[i],wpdj);        
          strcpy(sbck_sbmc[i],sbmc);        
          strcpy(sbck_cksl[i],cksl);        
//          strcpy(sbck_ckfs[i],ckfs);        
          strcpy(sbck_zje[i],zje);        
//          strcpy(sbck_ckn[i],ckn);        
//          strcpy(sbck_cky[i],cky);        
//          strcpy(sbck_ckr[i],ckr);        
//          strcpy(sbck_jbr[i],jbr);        
//          strcpy(sbck_yqdm[i],yqdm);        
//          strcpy(sbck_ssbm[i],ssbm);        
          strcpy(sbck_gdbh[i],gdbh);        
//          strcpy(sbck_pyjx[i],pyjx);        
//          strcpy(sbck_ckfx[i],ckfx);        
          strcpy(sbck_rkbh[i],rkbh);        
		}
        end_of_sbck_recs = num;
	    fclose(cfpe);
	}

	jqck_flag = 1;

	tjzje = tjzsl = 0;
	end_result_recs = 0;
	fpe = fopen("c:\\xxsbgl\\sbrkzm.dat","rb");
	if (fpe != NULL){
		fseek(fpe,0L,SEEK_END);
		l = ftell(fpe);
		num = l/453;
		fseek(fpe,0L,SEEK_SET);
	}
	else
		num = 0;
	num1 = 0;
	qfpe = NULL;
	qfpe = fopen("c:\\xxsbgl\\qczm.dat","rb");
    if (qfpe != NULL){
	  fseek(qfpe,0L,SEEK_END);
	  l = ftell(qfpe);
	  num1 = l/453;
	  fseek(qfpe,0L,SEEK_SET);
    }
    else
	  num1 = 0;

	l = num + num1 + 2;
	tofpe = fopen("c:\\xxsbgl\\dqzm.dat","wb");
    for (i=0;i<num+num1;i++){
      if (i < num){
            fread(&(tzm.reserve[0]),sizeof(zmstrt),1,fpe);
	  }
	  else{
            fread(&(tzm.reserve[0]),sizeof(zmstrt),1,qfpe);
      }
		    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);
		    strcpy(zje,tzm.zje);
		    strcpy(rkfs,tzm.rkfs);
		    strcpy(sfdzp,tzm.sfdzp);
		    strcpy(ssbm,tzm.ssbm);
		    strcpy(jbr,tzm.jbr);
		    strcpy(ghdw,tzm.ghdw);
		    strcpy(rkn,tzm.rkn);
		    strcpy(rky,tzm.rky);
		    strcpy(rkr,tzm.rkr);
	  sl1 = atof(wpsl);
	  bh1 = atoi(kcbh);
	  sl1 = atof(wpsl);
	  for (k=0;k<end_of_sbck_recs;k++){
		bh = atoi(sbck_rkbh[k]);
		if (((i < num)&&(bh > 10000))||
			((i >= num)&&(bh < 10000))){
		  if (bh > 10000)
			bh -= 10000;
          if (bh == bh1){
            sl = atof(sbck_cksl[k]);
	        sl1 -= sl;
		  }
		}
      }
	  if (sl1 < 0){
        strcpy(buf,"您的出入库帐目存在混乱,请检查.");
	    strcat(buf,sbmc);
	    MessageBox(NULL,buf,"",MB_OK);
	    fclose(fpe);
	    return ;
      }
	  strcpy(tzm.reserve,"~");
	  strcpy(tzm.jfxs,jfxs);
      strcpy(tzm.yzf,yzf);
      strcpy(tzm.rkbh,kcbh);
      strcpy(tzm.pyjx,pyjx);
      strcpy(tzm.gdbh,gdbh);
      strcpy(tzm.yqdm,yqdm);
      strcpy(tzm.sbmc,sbmc);
      strcpy(tzm.scdm,scdm);
      strcpy(tzm.cjpp,cjpp);
      strcpy(tzm.xhgg,xhgg);
      strcpy(tzm.wpdj,wpdj);
      sprintf(buf,"%.2lf",sl1);
	  if ((buf[strlen(buf)-1] == '0')&&(buf[strlen(buf)-2] == '0')&&(buf[strlen(buf)-3] == '.'))
	    buf[strlen(buf)-3] = 0;
      strcpy(tzm.wpsl,buf);
      f1 = atof(wpdj);
      f = sl1 * f1;
      sprintf(buf,"%.2lf",f);
      strcpy(tzm.zje,buf);
      strcpy(tzm.rkfs,rkfs);
      strcpy(tzm.sfdzp,sfdzp);
      strcpy(tzm.ssbm,ssbm);
      strcpy(tzm.jbr,jbr);
      strcpy(tzm.ghdw,ghdw);
      strcpy(tzm.rkn,rkn);
      strcpy(tzm.rky,rky);
      strcpy(tzm.rkr,rkr);
	  fwrite((void *)(&(tzm.reserve[0])),sizeof(zmstrt),1,tofpe);
    }
	if (fpe != NULL)
	  fclose(fpe);
	if (qfpe != NULL)
	  fclose(qfpe);
	fclose(tofpe);
}

void Cyszmcxdlg::OnEditchangekcn() 
{
	// TODO: Add your control notification handler code here
	
}

void Cyszmcxdlg::OnEditchangekcy() 
{
	// TODO: Add your control notification handler code here
	
}

void Cyszmcxdlg::OnEditchangekcr() 
{
	// TODO: Add your control notification handler code here
	
}

void Cyszmcxdlg::Onkucunchaxun() 
{
	// TODO: Add your control notification handler code here
	FILE *fpe;
	long l;
	int num,i,j,k,t;
	long t0,t1,t2;
	char bu[500];
	char buf[100];
	double tjzje,tjzsl;
	double f,f1,f2,f3,sl,sl1;
	int jqck_flag,bh,bh1,num1;
	FILE *cfpe,*qfpe;
	int jslsk_flag,n,y,r;
	int t_kcn,t_cur_year;
	int t_kcy,t_kcr;

	GetDlgItemText(IDC_kcn,buf,10);
    t_kcn = atoi(buf);
	GetDlgItemText(IDC_kcy,buf,10);
    t_kcy = atoi(buf);
	GetDlgItemText(IDC_kcr,buf,10);
    t_kcr = atoi(buf);
	int year;

    time_t ltime;    
	struct tm *pti;

    time(&ltime);    
	pti = gmtime(&ltime);
	year = pti->tm_year + 1900;
    t_cur_year = year;
	if (t_kcn != t_cur_year){
	  g_lishi_flag = 1;
	  strcpy(g_cur_year,buf);
    }
	else
	  g_lishi_flag = 0;
	if (g_lishi_flag == 1){
      strcpy(buf,"c:\\xxsbgl\\");
	  strcat(buf,g_cur_year);
	  strcat(buf,"sbckzm.dat");
      cfpe = fopen(buf,"rb");
    }
	else
      cfpe = fopen("c:\\xxsbgl\\sbckzm.dat","rb");
	if (cfpe == NULL){
	  end_of_sbck_recs = 0;
	}
	else{
	  fseek(cfpe,0L,SEEK_END);
	  l = ftell(cfpe);
	  num = l/280;
	  fseek(cfpe,0L,SEEK_SET);
      for (i=0;i<num;i++){
		  fread(&(sbckunit.reserve[0]),sizeof(sbckstrt),1,cfpe);
		  strcpy(ckbh,sbckunit.ckbh);
		  strcpy(wpdj,sbckunit.wpdj);
		  strcpy(sbmc,sbckunit.sbmc);
		  strcpy(cksl,sbckunit.cksl);
		  strcpy(ckfs,sbckunit.ckfs);
		  strcpy(zje,sbckunit.zje);
		  strcpy(ckn,sbckunit.ckn);
		  strcpy(cky,sbckunit.cky);
		  strcpy(ckr,sbckunit.ckr);
		  strcpy(jbr,sbckunit.jbr);
		  strcpy(yqdm,sbckunit.yqdm);
		  strcpy(ssbm,sbckunit.ssbm);
		  strcpy(gdbh,sbckunit.gdbh);
		  strcpy(pyjx,sbckunit.pyjx);
		  strcpy(ckfx,sbckunit.ckfx);
		  strcpy(rkbh,sbckunit.rkbh);
          
		  strcpy(sbck_ckbh[i],ckbh);        
          strcpy(sbck_wpdj[i],wpdj);        
          strcpy(sbck_sbmc[i],sbmc);        
          strcpy(sbck_cksl[i],cksl);        
//          strcpy(sbck_ckfs[i],ckfs);        
          strcpy(sbck_zje[i],zje);        
//          strcpy(sbck_ckn[i],ckn);        
//          strcpy(sbck_cky[i],cky);        
//          strcpy(sbck_ckr[i],ckr);        
//          strcpy(sbck_jbr[i],jbr);        
//          strcpy(sbck_yqdm[i],yqdm);        
//          strcpy(sbck_ssbm[i],ssbm);        
          strcpy(sbck_gdbh[i],gdbh);        
//          strcpy(sbck_pyjx[i],pyjx);        
//          strcpy(sbck_ckfx[i],ckfx);        
          strcpy(sbck_rkbh[i],rkbh);        
	  }
      end_of_sbck_recs = num;
	  fclose(cfpe);
	}

	tjzje = tjzsl = 0;
	end_result_recs = 0;
	m_result.SetRows(2L);
	m_result.SetRow(1L);
	for (l=0;l<=13;l++){
	  m_result.SetCol(l);
	  m_result.SetText("");
    }
	if (g_lishi_flag == 1){
        strcpy(buf,"c:\\xxsbgl\\");
		strcat(buf,g_cur_year);
		strcat(buf,"sbrkzm.dat");
        fpe = fopen(buf,"rb");
    }
	else
	    fpe = fopen("c:\\xxsbgl\\sbrkzm.dat","rb");
	if (fpe != NULL){
		fseek(fpe,0L,SEEK_END);
		l = ftell(fpe);
		num = l/453;
		fseek(fpe,0L,SEEK_SET);
	}
	else
		num = 0;
	num1 = 0;
	qfpe = NULL;
	if (g_lishi_flag == 1){
      strcpy(buf,"c:\\xxsbgl\\");
	  strcat(buf,g_cur_year);
	  strcat(buf,"qczm.dat");
      qfpe = fopen(buf,"rb");
	}
	else
	  qfpe = fopen("c:\\xxsbgl\\qczm.dat","rb");
	if (qfpe != NULL){
	  fseek(qfpe,0L,SEEK_END);
	  l = ftell(qfpe);
	  num1 = l/453;
	  fseek(qfpe,0L,SEEK_SET);
    }
    else
	  num1 = 0;

	l = num + num1 + 2;
	m_result.SetRows(l);
    for (i=0;i<num+num1;i++){
      if (i < num){
            fread(&(tzm.reserve[0]),sizeof(zmstrt),1,fpe);

⌨️ 快捷键说明

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