📄 sbck.cpp
字号:
g_yszm_xzsb_flag = 1;
SetDlgItemText(IDC_pyjx,g_e_abbr[i]);
SetDlgItemText(IDC_sbmc,g_e_name[i]);
SetDlgItemText(IDC_gdbh,g_a_id[i]);
SetDlgItemText(IDC_yqdm,g_e_code[i]);
SetDlgItemText(IDC_scdm,g_p_id[i]);
if (g_old_htreeitem != g_htreeitem[i]){
if (g_old_htreeitem != NULL){
m_sbs.SetItemState(g_old_htreeitem,0,0xffff);
}
}
m_sbs.Select(g_htreeitem[i],TVGN_FIRSTVISIBLE);
m_sbs.SetItemState(g_htreeitem[i],TVIS_DROPHILITED,0xffff);
g_old_htreeitem = g_htreeitem[i];
CWnd *wnd;
wnd = GetDlgItem(IDC_chaxun);
wnd->SetFocus();
}
else{
g_xzxzsb_flag = 0;
}
}
else{
g_yszm_xzsb_flag = 0;
}
}
void sbck::Onchaxun()
{
// TODO: Add your control notification handler code here
long l;
int num,i,j,k;
char bu[500];
char bu1[500];
char buf[100];
float f,f1;
FILE *fpe,*fpe1,*cfpe,*tofpe,*c1fpe;
float sl,dj,je;
int num1,num2;
int t1,t2;
char cond[20];
int order;
char mc[51];
int end_of_sbck1_recs;
int flag1;
end_result_recs = 0;
m_sbck.SetRows(2L);
m_sbck.SetRow(1L);
for (l=0;l<=13;l++){
m_sbck.SetCol(l);
m_sbck.SetText("");
}
fpe = fopen("c:\\xxsbgl\\qczm.dat","rb");
if (fpe == NULL)
return ;
fpe1 = fopen("c:\\xxsbgl\\sbrkzm.dat","rb");
tofpe = fopen("c:\\xxsbgl\\dqzm.dat","wb");
if (tofpe == NULL)
return ;
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);
}
c1fpe = fopen("c:\\xxsbgl\\sbck.dat","rb");
if (c1fpe == NULL){
end_of_sbck1_recs = 0;
}
else{
fseek(c1fpe,0L,SEEK_END);
l = ftell(c1fpe);
num = l/280;
fseek(c1fpe,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[end_of_sbck_recs+i],ckbh);
strcpy(sbck_wpdj[end_of_sbck_recs+i],wpdj);
strcpy(sbck_sbmc[end_of_sbck_recs+i],sbmc);
strcpy(sbck_cksl[end_of_sbck_recs+i],cksl);
// strcpy(sbck_ckfs[i],ckfs);
strcpy(sbck_zje[end_of_sbck_recs+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[end_of_sbck_recs+i],gdbh);
// strcpy(sbck_pyjx[i],pyjx);
// strcpy(sbck_ckfx[i],ckfx);
strcpy(sbck_rkbh[end_of_sbck_recs+i],rkbh);
}
end_of_sbck1_recs = num;
fclose(c1fpe);
}
end_of_sbck_recs += end_of_sbck1_recs;
fseek(fpe,0L,SEEK_END);
l = ftell(fpe);
num1 = l/453;
fseek(fpe,0L,SEEK_SET);
if (fpe1 != NULL){
fseek(fpe1,0L,SEEK_END);
l = ftell(fpe1);
num2 = l/453;
fseek(fpe1,0L,SEEK_SET);
}
else
num2 = 0;
num = num1 + num2;
GetDlgItemText(IDC_gdbh,cond,20);
GetDlgItemText(IDC_sbmc,mc,50);
trim(mc);
num_of_yszm_recs = num1;
num_of_sbrk_recs = num2;
order = 0;
l = num+2;
m_sbck.SetRows(l);
for (i=0;i<num;i++){
if (i < num1)
fread(&(tzm.reserve[0]),sizeof(zmstrt),1,fpe);
else
fread(&(tzm.reserve[0]),sizeof(zmstrt),1,fpe1);
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);
trim(sbmc);
if (((if_belong(cond,gdbh))&&
((strcmp(mc,sbmc) == 0)||
((cond[5] == '0')&&(cond[4] == '0'))))||
(cond[0] == 0)){
sl = atof(wpsl);
for (j=0;j<end_of_sbck_recs;j++){
t1 = atoi(sbck_rkbh[j]);
t2 = atoi(kcbh);
flag1 = 0;
if (t1 >= 10000){
if (i >= num1){
if (t1-10000 == t2)
flag1 = 1;
}
}
else{
if (i < num1){
if (t1 == t2)
flag1 = 1;
}
}
if (flag1 == 1){
f1 = atof(sbck_cksl[j]);
sl -= f1;
}
}
if (sl > 0.001){
order_of_result_recs[end_result_recs] = end_result_recs;
l = end_result_recs + 2;
// m_sbck.SetRows(l);
m_sbck.SetRow(l-1L);
m_sbck.SetCol(0L);
t1 = atoi(kcbh);
if (i < num1){
itoa(t1,kcbh,10);
}
else{
itoa(t1+10000,kcbh,10);
}
m_sbck.SetText(kcbh);
m_sbck.SetCol(1L);
m_sbck.SetText(sbmc);
m_sbck.SetCol(2L);
m_sbck.SetText(wpdj);
m_sbck.SetCol(3L);
if ((gdbh[0] == '1')&&(gdbh[1] == '0')){
sprintf(wpsl,"%.2f",sl);
}
else{
t1 = sl;
sprintf(wpsl,"%d",t1);
}
for (k=291-89;k<321-89;k++)
bu[k] = ' ';
for (k=0;k<strlen(wpsl);k++){
bu[291-89+k] = wpsl[k];
}
bu[291-89+strlen(wpsl)] = '\n';
m_sbck.SetText(wpsl);
m_sbck.SetCol(4L);
dj = atof(wpdj);
je = dj*sl;
sprintf(zje,"%.2f",je);
for (k=0;k<strlen(zje);k++){
bu[306-89+k] = zje[k];
}
bu[306-89+strlen(zje)] = '\n';
m_sbck.SetText(zje);
m_sbck.SetCol(5L);
strcpy(buf,rkn);
strcat(buf,"年");
strcat(buf,rky);
strcat(buf,"月");
strcat(buf,rkr);
strcat(buf,"日");
m_sbck.SetText(buf);
m_sbck.SetCol(6L);
m_sbck.SetText(xhgg);
m_sbck.SetCol(7L);
m_sbck.SetText(jbr);
m_sbck.SetCol(8L);
m_sbck.SetText(gdbh);
m_sbck.SetCol(9L);
m_sbck.SetText(sfdzp);
m_sbck.SetCol(10L);
m_sbck.SetText(cjpp);
m_sbck.SetCol(11L);
m_sbck.SetText(ghdw);
m_sbck.SetCol(12L);
m_sbck.SetText(ssbm);
m_sbck.SetCol(13L);
m_sbck.SetText(rkfs);
m_sbck.SetCol(14L);
m_sbck.SetText(yqdm);
m_sbck.SetCol(15L);
m_sbck.SetText(scdm);
m_sbck.SetCol(16L);
m_sbck.SetText(pyjx);
end_result_recs ++;
fwrite(bu1,89,1,tofpe);
fwrite(bu,453,1,tofpe);
}
}
}
/*
fseek(fpe1,0L,SEEK_END);
l = ftell(fpe1);
num = l/453;
fseek(fpe1,0L,SEEK_SET);
for (i=0;i<num;i++){
fread(bu,453,1,fpe1);
bu[0] = 'r';
fwrite(bu,453,1,tofpe);
}
*/
if (fpe != NULL)
fclose(fpe);
if (fpe1 != NULL)
fclose(fpe1);
fclose(tofpe);
old_sel_row = -1;
}
void sbck_clear_read_data()
{
if (rkbh[0] == '~'){
rkbh[0] = 0;
}
if (ckbh[0] == '~'){
ckbh[0] = 0;
}
if (sbmc[0] == '~'){
sbmc[0] = 0;
}
if (gdbh[0] == '~'){
gdbh[0] = 0;
}
if (yqdm[0] == '~'){
yqdm[0] = 0;
}
if (scdm[0] == '~'){
scdm[0] = 0;
}
if (pyjx[0] == '~'){
pyjx[0] = 0;
}
if (ckfs[0] == '~'){
ckfs[0] = 0;
}
if (ckn[0] == '~'){
ckn[0] = 0;
}
if (cky[0] == '~'){
cky[0] = 0;
}
if (ckr[0] == '~'){
ckr[0] = 0;
}
if (cksl[0] == '~'){
cksl[0] = 0;
}
if (jbr[0] == '~'){
jbr[0] = 0;
}
}
BOOL if_belong(char cond[20],char gdbh[20])
{
char buf[20];
char buf1[20];
int j;
if (cond[0] == 0)
return TRUE;
strcpy(buf,cond);
j = strlen(buf);
if (j > 0)
j --;
while (buf[j] == ' '){
buf[j] = 0;
j --;
if (j == 0)
break;
}
// if (j > 0)
// j --;
while (buf[j] == '0'){
buf[j] = 0;
j --;
if (j == 0)
break;
}
strcpy(buf1,gdbh);
j = strlen(buf1);
if (j > 0)
j --;
while (buf1[j] == ' '){
buf1[j] = 0;
j --;
if (j == 0)
break;
}
// if (j > 0)
// j --;
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;
}
return TRUE;
}
void sbck::OnSetfocusckfs()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_ckfs);
switch_to_english_mode(wnd);
cur_focus = 3;
}
void sbck::OnEditchangeckfs()
{
// TODO: Add your control notification handler code here
char buf[20];
GetDlgItemText(IDC_ckfs,buf,20);
if (buf[0] != 0){
if (m_ckfs.SelectString(0,buf) == CB_ERR){
SetDlgItemText(IDC_ckfs,"");
}
}
}
void sbck::OnSetfocuscksl()
{
// TODO: Add your control notification handler code here
CWnd *wnd;
wnd = GetDlgItem(IDC_cksl);
switch_to_english_mode(wnd);
cur_focus = 4;
}
void sbck::OnChangecksl()
{
char buf[40];
char buf1[40];
char buff[40];
int l,i,flag,j;
GetDlgItemText(IDC_cksl,buf,12);
l = strlen(buf);
if (l > 0){
if (l > 8){
buf[8] = 0;
SetDlgItemText(IDC_cksl,buf);
Set_to_item_end(this,IDC_cksl);
}
for (i=0;i<l;i++){
if (((buf[i] < '0')||(buf[i] > '9'))&&(buf[i] != '.')){
buf[i] = 0;
SetDlgItemText(IDC_cksl,buf);
Set_to_item_end(this,IDC_cksl);
}
}
l = strlen(buf);
flag = 0;
for (i=0;i<l;i++){
if (buf[i] == '.'){
GetDlgItemText(IDC_gdbh,buf1,20);
if ((buf1[0] != '1') || (buf1[1] != '0') || (strlen(buf1) < 6)){
buf[i] = 0;
SetDlgItemText(IDC_cksl,buf);
Set_to_item_end(this,IDC_cksl);
}
else{
GetDlgItemText(IDC_gdbh,buf1,20);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -